strip newlines and blanks

2006-05-01 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn <-newline opqrs tuvwxyz I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open("test.dat") while 1: line = f.readline().rstrip("\n") if line == '':

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread BartlebyScrivener
No way. You didn't deserve it. Unless you came from another OO language, the Guido tutorial on Classes is unintelligible. It assumes way too much knowledge. But I found something else that looks promising that you may want to peek at: http://pytut.infogami.com/node11-baseline.html rd Reply --

stripping blanks

2006-05-01 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn <-newline opqrs tuvwxyz <---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open("test.dat") while 1: line = f.readline().rstrip("\n")

stripping

2006-05-01 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn <-newline opqrs tuvwxyz <---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open("test.dat") while 1: line = f.readline().rstrip("\n")

Re: Popping from the middle of a deque + deque rotation speed

2006-05-01 Thread Tim Peters
[Russell Warren] > ... > As to indexing into a deque being O(index)... I didn't realize that. > It is certainly something to keep in mind, though... looping through > the contents of a deque would obviously be a bad idea with this being > the case! I wonder if the generator for the deque helps red

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread doobiz
Just my opinion, but I think the Guido tutorial on Classes is unintelligible unless you're coming from another OO language. But I found something else that looks promising that you may want to peek at: http://pytut.infogami.com/node11-baseline.html rd -- http://mail.python.org/mailman/listinf

SGML parsing tags and leeping track

2006-05-01 Thread hapaboy2059
Hello, I need help in using sgmlparser to parse a html file and keep track of the number of times each tag is being used. In the end of this program I need to print out the number of times each tag was seen(presumably any type of tag can be used) and the linked text. I need help in getting past

Re: Non-web-based templating system

2006-05-01 Thread John Hunter
> "Alex" == Alex Martelli <[EMAIL PROTECTED]> writes: Alex> I have a certain fondness for the first over-100-lines Alex> module I wrote for Python, which eventually resulted in: As well you should! YAPTU powers the entire matplotlib website (screenshots, FAQ, what's new, etc), as evi

Re: Can Python kill a child process that keeps on running?

2006-05-01 Thread Serge Orlov
I. Myself wrote: > Serge Orlov wrote: > > I. Myself wrote: > > > >> Suppose we spawn a child process with Popen. I'm thinking of an > >> executable file, like a compiled C program. > >> Suppose it is supposed to run for one minute, but it just keeps going > >> and going. Does Python have any way

Re: Python distutil: build libraries before modules

2006-05-01 Thread Bo Peng
Bo Peng wrote: > How can I let setup.py build these boost libraries separately so that I > can link them to my modules? This will also save some link time because > all my python modules link to the same boost libraries. Although this is nowhere documented, I find that I can use from distutils

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Steve Holden
Edward Elliott wrote: > Holger wrote: > >>oops, that was kinda embarrassing. > > > It's really not. You got a completely unhelpful error message saying you > passed 2 args when you only passed one explicitly. The fact the b is also > an argument to b.addfile(f) is totally nonobvious until you

Re: using ftplib

2006-05-01 Thread Steve Holden
John Salerno wrote: [...] > > So if I already have files on the server and I want to change file > permissions, do I need to mess with TYPE A/TYPE I commands, or are those > strictly for when you *transfer* files? Because I just did a quick test > of changing file permissions through my FTP pro

Re: Can Python kill a child process that keeps on running?

2006-05-01 Thread Steve Holden
I. Myself wrote: > Serge Orlov wrote: > >>I. Myself wrote: >> >> >>>Suppose we spawn a child process with Popen. I'm thinking of an >>>executable file, like a compiled C program. >>>Suppose it is supposed to run for one minute, but it just keeps going >>>and going. Does Python have any way to

Re: Can Python kill a child process that keeps on running?

2006-05-01 Thread Steve Holden
I. Myself wrote: > Serge Orlov wrote: > >>I. Myself wrote: >> >> >>>Suppose we spawn a child process with Popen. I'm thinking of an >>>executable file, like a compiled C program. >>>Suppose it is supposed to run for one minute, but it just keeps going >>>and going. Does Python have any way to

Re: Can Python kill a child process that keeps on running?

2006-05-01 Thread I. Myself
Serge Orlov wrote: > I. Myself wrote: > >> Suppose we spawn a child process with Popen. I'm thinking of an >> executable file, like a compiled C program. >> Suppose it is supposed to run for one minute, but it just keeps going >> and going. Does Python have any way to kill it? >> >> This is no

Python distutil: build libraries before modules

2006-05-01 Thread Bo Peng
Dear list, My python modules depend on a few boost libraries. For convenience, I include the source code of these libraries with my distribution and treat them as standard source files. This results in huge cc.exe command lines and I get an error saying error: command 'cc' failed: Invalid ar

Re: Can Python kill a child process that keeps on running?

2006-05-01 Thread Serge Orlov
I. Myself wrote: > Suppose we spawn a child process with Popen. I'm thinking of an > executable file, like a compiled C program. > Suppose it is supposed to run for one minute, but it just keeps going > and going. Does Python have any way to kill it? > > This is not hypothetical; I'm doing it now

Re: set partitioning

2006-05-01 Thread James Waldby
"[EMAIL PROTECTED]" wrote: > Can someone tell me of a good algorithm to partition a set of n > elements into m non-empty, disjoint subsets, where each subset has > size k? and later wrote in a separate post > Also, if I do not care about the number of subsets, what is a good > algorithm to partiti

request help with Pipe class in iterwrap.py

2006-05-01 Thread Steve R. Hastings
While studying iterators and generator expressions, I started wishing I had some tools for processing the values. I wanted to be able to chain together a set of functions, sort of like the "pipelines" you can make with command-line programs. So, I wrote a module called iterwrap.py. You can downl

Re: set partitioning

2006-05-01 Thread hymort
For the list [1,2,3,4], I'm looking for the following for k = 2: [[1,2], [3,4]] [[1,3], [2,4]] [[1,4], [2,3]] for k = 3: [[1,2,3], [4]] [[1,2,4], [3]] [[1,3,4], [2]] [[2,3,4], [1]] -- http://mail.python.org/mailman/listinfo/python-list

Using elementtree: replacing nodes

2006-05-01 Thread André
I've started using elementtree and don't understand how to use it to manipulate and replace nodes. I know how to do this using a simple, but inefficient parser I wrote, but I'd rather learn to use a better tool - especially as it is to be added to the standard library. I'll use a simple, but repr

Re: Popping from the middle of a deque + deque rotation speed

2006-05-01 Thread Russell Warren
> So does the speed of the remaining 0.001 cases really matter? Note > that even just indexing into a deque takes O(index) time. It doesn't matter as much, of course, but I was looking to make every step as efficient as possible (while staying in python). As to indexing into a deque being O(inde

ANN: Urwid 0.9.4 - Console UI Library

2006-05-01 Thread Ian Ward
Announcing Urwid 0.9.4 -- Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.4.tar.gz About this release: === This release adds mouse event handling to the standard widgets and example programs. Also, the files used

Can Python kill a child process that keeps on running?

2006-05-01 Thread I. Myself
Suppose we spawn a child process with Popen. I'm thinking of an executable file, like a compiled C program. Suppose it is supposed to run for one minute, but it just keeps going and going. Does Python have any way to kill it? This is not hypothetical; I'm doing it now, and it's working pretty

Packet finding and clicking...

2006-05-01 Thread klauts
how would i make a script for windows xp that looks inside a java app watchng packets coming in and out and clicks when on the place on the screen where a certain packet is found. say it look for 12332 wich is a tree and clicks it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Popping from the middle of a deque + deque rotation speed

2006-05-01 Thread Russell Warren
Thanks for the responses. > It seems to work with my Python2.4 here. If you're > interested in efficiency, I'll leave their comparison as an > exercise to the reader... :) Ok, exercise complete! :) For the record, they are pretty much the same speed... >>> s = """ ... from collections import d

Re: list*list

2006-05-01 Thread Ziga Seilnacht
BBands wrote: > There must be a better way to multiply the elements of one list by > another: [snipped] > Perhaps a list comprehension or is this better addressed by NumPy? If you have a large amount of numerical code, it is definetly better to use numpy, since it is intended just for that purpo

Re: set partitioning

2006-05-01 Thread Michael Ekstrand
On Mon, May 01, 2006 at 03:42:53PM -0700, [EMAIL PROTECTED] wrote: > Not quite what I'm looking for. I would like a list of all partitions > with each partition having k or less elements, not just one instance. def partition(S, k): parts = [] ct = 0 cp = [] for elem in S:

Dr. Dobb's Python-URL! - weekly Python news and links (May 1)

2006-05-01 Thread Peter Otten
QOTW: "I have a certain fondness for the first over-100-lines module I wrote for Python" - Alex Martelli "Programmers should be paid by the amount of code that they avoid writing." - Michael P. Soulier If you know Python basics but managed to get along without creating your own classes,

Re: python colorfinding

2006-05-01 Thread pain . and . cookies
sorry in a java app running on windows XP -- http://mail.python.org/mailman/listinfo/python-list

Re: set partitioning

2006-05-01 Thread [EMAIL PROTECTED]
Hello, Not quite what I'm looking for. I would like a list of all partitions with each partition having k or less elements, not just one instance. [EMAIL PROTECTED] wrote: > Something like this, or am I missing something? > > def partition(List, n, m, k): > if n!=m*k: > raise "so

Re: set partitioning

2006-05-01 Thread aaronwmail-usenet
Something like this, or am I missing something? def partition(List, n, m, k): if n!=m*k: raise "sorry, too many or too few elts" D = {} for x in List: D[x] = 1 if len(D)!=n: raise "sorry (2) you lied about the number" List2 = D.keys() resul

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Edward Elliott
Scott David Daniels wrote: > Actually I think it was a combination of CP/M and DOS that popularized > the ZIP format; essentially the floppy-disk set, for whom the zip format > was a godsend. Ah you're right. I just lump all Microsoft OSes under the term 'Windows' now, though I suppose that's unf

Re: set partitioning

2006-05-01 Thread [EMAIL PROTECTED]
Also, if I do not care about the number of subsets, what is a good algorithm to partition a set of n elements into non-empty, disjoint subsets of size k? -- http://mail.python.org/mailman/listinfo/python-list

set partitioning

2006-05-01 Thread [EMAIL PROTECTED]
Can someone tell me of a good algorithm to partition a set of n elements into m non-empty, disjoint subsets, where each subset has size k? -- http://mail.python.org/mailman/listinfo/python-list

SciTE: Printing in Black & White

2006-05-01 Thread Sandy
Dear Pythonic People, I recently discovered SciTE (1.68) as a programming editor, and I find it just beautiful. Small, fast, elegant and beautiful. I particularly like syntax highlighting features -- not simply different colours, but styles and fonts too. I don't know whether this is th

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Edward Elliott
Holger wrote: > oops, that was kinda embarrassing. It's really not. You got a completely unhelpful error message saying you passed 2 args when you only passed one explicitly. The fact the b is also an argument to b.addfile(f) is totally nonobvious until you know that 1) b is an object not a modu

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Scott David Daniels
Edward Elliott wrote: > Scott David Daniels wrote: > >> Edward Elliott wrote: >>> Scott David Daniels wrote: ... >> > ... You windows kids and your crazy data formats. >> There were a few oth OS's than Linux and Windows. Maybe you >> should call me "you crazy Tenex kid." > > Windows popu

Re: Setting a module package to use new-style classes

2006-05-01 Thread Ben Finney
"Panos Laganakos" <[EMAIL PROTECTED]> writes: > Is there a way to have a whole module package use the new-style > classes, without having to specify it per module-file or even worse, > per class definition? TTBOMK, you do that with a single statement per module, before any class definitions:

Re: using ftplib

2006-05-01 Thread John Salerno
Dave Hughes wrote: > Indeed. FTP is a tricky (and _very_ old) protocol that does things in a > very different manner to the later (simpler) protocols like HTTP. Not > sure how familiar you are with FTP, so my apologies if I wind up > repeating stuff you know already: Thanks very much, all that in

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Holger
I guess I deserved that. :-( I *did* read the tutorial, but then I forgot and didn't notice... My brain is getting is slow - so thx for the friendly slap in the face ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: An Atlas of Graphs with Python

2006-05-01 Thread Paddy
A little off topic I'm afraid Giandomenico, But I had to smile. Here is someone working in the field of linguistics, who wants a programming solution, in the language Python. (It's Larry Wall, creator of Perl that cites his linguistic foundations). -- Pad. -- http://mail.python.org/mailman/list

Re: regd efficient methods to manipulate *large* files

2006-05-01 Thread Paddy
I take it that you have a binary file that takes a file name and proceses the file contents. Sometimes Unix binaries are written so that a file name of '-', (just a dash), causes it to take input from stdin so that the piping mentioned in a previous reply could work. On some of our unix systems /tm

Re: list*list

2006-05-01 Thread Diez B. Roggisch
Klaas schrieb: > Diez wrote: >> First of all: it's considered bad style to use range if all you want is a >> enumeration of indices, as it will actually create a list of the size you >> specified. Use xrange in such cases. > >> But maybe nicer is zip: >> c = [av * bv for av, bv in zip(a, b)] > >

Re: python about mobile game?

2006-05-01 Thread cyberco
http://sourceforge.net/projects/pys60 -- http://mail.python.org/mailman/listinfo/python-list

Difference between threading.local and protecting data with locks

2006-05-01 Thread juxstapose
Hello, I have been develop a blocking socket application with threading. The main thread handles connections and inserts them into python's protected queue as jobs for the thread pool to handle. There is not much information on threading.local except that it states that in maintains variable uniq

Re: using ftplib

2006-05-01 Thread Dave Hughes
John Salerno wrote: > I'm experimenting with this now and I'm a little confused about > transferring commands. This might be more of an FTP question than > strictly Python, but it's still related to how to use the ftplib > methods. > > Anyway, if what I want to do is send a command to change the

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Edward Elliott
Scott David Daniels wrote: > Edward Elliott wrote: >> Scott David Daniels wrote: >>>... > > ... You windows kids and your crazy data formats. > There were a few oth OS's than Linux and Windows. Maybe you > should call me "you crazy Tenex kid." Windows popularized the zip format, but if you in

Could not find platform independent libraries

2006-05-01 Thread pythonhelpneeded
While building Python 2.4.3 on SCO OpenServer 5.0.5, I'm getting the error below. The modules mentioned seem to be available in the Lib subdirectory. I've tried setting PYTHONHOME to the build directory (/tmp/Python-2.4.3), it didn't help. Any help would be appreciated. # make case $MAK

[ANN] markup.py 1.4 - bugfix

2006-05-01 Thread Daniel Nogradi
I'm terribly sorry but there was a crucial bug left in the 1.3 release announced today. Thanks to a user now it's fixed, and the new 1.4 release is available on http://markup.sourceforge.net/ which should be okay. Sorry for the inconvenience :) -- http://mail.python.org/mailman/listinfo/python-li

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan
WOW, Thanks guys. I am really awestruck by the speed you guys relied with. Thanks a lot for the help. I eventually found a way that did the job for me. I will definitely visit this Group more often. Thanks for all the help! :D -- http://mail.python.org/mailman/listinfo/python-list

Re: stdin: processing characters

2006-05-01 Thread Russ Salsbury
Serge Orlov wrote: > Kevin Simmons wrote: > > Looks reasonable if you don't need portability. But you may want to > refactor it a little bit to make sure terminal setting are always > restored: > > try: > do_all_the_work() > finally: > os.system("stty cooked") > IIRC You need to do "stty

Re: regd efficient methods to manipulate *large* files

2006-05-01 Thread Dave Hughes
Madhusudhanan Chandrasekaran wrote: > Hi: > > This question is not directed "entirely" at python only. But since > I want to know how to do it in python, I am posting here. > > > I am constructing a huge matrix (m x n), whose columns n are stored in > smaller files. Once I read m such fil

using ftplib

2006-05-01 Thread John Salerno
I'm experimenting with this now and I'm a little confused about transferring commands. This might be more of an FTP question than strictly Python, but it's still related to how to use the ftplib methods. Anyway, if what I want to do is send a command to change the file permission settings of a

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Steve Poe
Daniel,Before writing your script, what is your general approach to backup configuration files? Do you tar/zip them into one file? Do you ftp/ssh each file to another server? One approach I've used in backing up files from another server is: from ftplib import FTPdef handleDownload(block):    file.

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > Oh, I saw the smiley. I knew it was meant to be humorous. I > just didn't understand it. The only "batteries" reference I > know of in this context is the "batteries included" philosophy > of the stdlib. Of course, none of Numeric, numarray,

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Michael Ekstrand
On Mon, May 01, 2006 at 12:42:58PM -0700, Merrigan wrote: > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home/testuser/projects/" I need to extract the "projects" part. The > problem is that the directory names t

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Fredrik Lundh
"Merrigan" wrote: > I am trying to write a script to backup all my company's server configs > weekly. The script will run in a cronjob, on whatever I set it. > > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Mike Kent
Python 2.4.2 (#1, Nov 29 2005, 14:04:55) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> d = "/home/testuser/projects" >>> os.path.basename(d) 'projects' >>> os.path.dirname(d) '/home/testuser' >>> --

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan Took
Daniel Nogradi wrote: >> Hi, >> >> I am trying to write a script to backup all my company's server configs >> weekly. The script will run in a cronjob, on whatever I set it. >> >> The issue I am currently having isto "extract" the directory name from >> a given directory string. For example: from t

Passing events

2006-05-01 Thread Wesley Brooks
Dear Users,Is it possible to pass events such as keyboard, mouse, and joystick events to any software application and take screen shots? In this example I would like to be able to control a car racing game using python script. Is it difficult to recieve and create events from devices like the steer

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Daniel Nogradi
> Hi, > > I am trying to write a script to backup all my company's server configs > weekly. The script will run in a cronjob, on whatever I set it. > > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home/testuser/p

How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan
Hi, I am trying to write a script to backup all my company's server configs weekly. The script will run in a cronjob, on whatever I set it. The issue I am currently having isto "extract" the directory name from a given directory string. For example: from the string "/home/testuser/projects/" I ne

Re: returning none when it should be returning a list?

2006-05-01 Thread Dave Hughes
Edward Elliott wrote: > [EMAIL PROTECTED] wrote: > > The function basically takes in a list of all the prime number > > found, it takes the next number to be tested for (next) and the > > limit it will go up to. It divide next by the list of previous > > prime numbers if next is not bigger than li

Re: list*list

2006-05-01 Thread Klaas
Diez wrote: > First of all: it's considered bad style to use range if all you want is a > enumeration of indices, as it will actually create a list of the size you > specified. Use xrange in such cases. > But maybe nicer is zip: > c = [av * bv for av, bv in zip(a, b)] By your logic, shouldn't it

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > >>Grant Edwards wrote: >> >>>On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: >>> >>>Perhaps the numarray module? >> >>numpy for new code, please. > >So numarray and numpy were both written to r

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: >> >>Perhaps the numarray module? > >numpy for new code, please. So numarray and numpy were both written to replace numeric? >>> >>>numpy was w

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > >Perhaps the numarray module? numpy for new code, please. >>> >>>So numarray and numpy were both written to replace numeric? >> >>numpy was written to replace both Numeric and numarray. > > too many batter

Re: how to do with the multi-frame GIF

2006-05-01 Thread Fredrik Lundh
Daniel Nogradi wrote: > The source distribution of the 1.1.4 version comes with a Scripts > directory where you can find player.py, gifmaker.py and explode.py > which all deal with animated gif. I don't know if they work with > version 1.1.5 though. they're still shipped with 1.1.5 (and 1.1.6), a

Re: how to do with the multi-frame GIF

2006-05-01 Thread Daniel Nogradi
> how to do with the multi-frame GIF, I used the PIL ,but it seems not > support? The source distribution of the 1.1.4 version comes with a Scripts directory where you can find player.py, gifmaker.py and explode.py which all deal with animated gif. I don't know if they work with version 1.1.5 thou

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Scott David Daniels
Edward Elliott wrote: > Scott David Daniels wrote: >>... > ... You windows kids and your crazy data formats. There were a few oth OS's than Linux and Windows. Maybe you should call me "you crazy Tenex kid." Knuth says, "the fastest way to search is to know where to go." -- Zips have locations of

Re: list*list

2006-05-01 Thread Diez B. Roggisch
> and for short sequences, it doesn't really matter much in the 2.X series. > it's definitely not "bad style" to use range instead of xrange for a ten > to, say, 1000 item loop. You and me are aware of that - but I figured the OP wasn't. And just the other day somebody on de.c.l.py wondered about

Re: list*list

2006-05-01 Thread Fredrik Lundh
David Isaac wrote: > > it's considered bad style to use range if all you want is a > > enumeration of indices, as it will actually create a list of the size you > > specified. Use xrange in such cases. > > I'm pretty sure this distinction goes away in 2.5. 3.0. and for short sequences, it doesn'

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: Perhaps the numarray module? >>> >>>numpy for new code, please. >> >> So numarray and numpy were both written to replace numeric? > > numpy was written to replace both Numeric and numarray. too many batteries... ;) -- Grant Edwards

Re: list*list

2006-05-01 Thread David Isaac
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > it's considered bad style to use range if all you want is a > enumeration of indices, as it will actually create a list of the size you > specified. Use xrange in such cases. I'm pretty sure this distinction goes away

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-04-30, Robert Kern <[EMAIL PROTECTED]> wrote: > >>Grant Edwards wrote: >>>Perhaps the numarray module? >> >>numpy for new code, please. > > So numarray and numpy were both written to replace numeric? numpy was written to replace both Numeric and numarray. There is

Re: self modifying code

2006-05-01 Thread [EMAIL PROTECTED]
Personally, I would almost always pay the x2 efficiency price in order to use a class. But then I don't know what you're writing. Of course, if you really need it to be efficient, you can write it as a C extension, or use Pyrex, etc. and get -much- better results. -- http://mail.python.org/mailm

Re: Numeric, vectorization

2006-05-01 Thread David Isaac
"RonnyM" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > e.g. y = [ 1, 2, 3, 4, 5, 6 ,7 ,8, 9 ] > ybar = [ 1, (1 + 3)*.5,(2 + 4)*.5,(3 + 5)*.5,..., (n-1 + n+1)*.5 ], n = > 1,...len(y) -1 > How do I make a vectorized version of this, I will prefer not to > utilize Map or similar funct

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

Numeric, vectorization

2006-05-01 Thread RonnyM
Hello. I want to vectorize this operation, which below is implemented as a for-loop: def smoothing_loop( y ): #y is an array with noisy values ybar = [] ybar.append( y[0] ) #Smoothing with a loop length = size( y ) for i in range( 1, length -1 ): ybar.append( .5 *

Multi-Monitor Support

2006-05-01 Thread Mark rainess
Hello, Does Python or wxPython include any support for multiple monitors. In my application multiple monitors are located at a distance. It is not convenient to move a window from the main monitor to one of the others. I want to have the option to open an an application on any connected monit

Re: Using a browser as a GUI: which Python package

2006-05-01 Thread Jacob Rael
I am looking for the samething. I was thinking of Karrigell. http://karrigell.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: An Atlas of Graphs with Python

2006-05-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Giandomenico Sica <[EMAIL PROTECTED]> wrote: > Call for Cooperation >An Atlas of Linguistic Graphs > >I'm a researcher in graph theory and networks. >I'm working about a project connected with the theory and the applications >of >linguistic graphs, which are mathema

[ANN] Movable Python 1.0.2

2006-05-01 Thread Fuzzyman
`Movable Python 1.0.2 `_ is now available. This release if for the Python 2.4 distribution of **Movable Python**, and is now available for `download `_. Features new to this release include : * Now built with Py

Re: list*list

2006-05-01 Thread Tim Chase
> There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? a = [1,2,3] b = [1,2,3

Re: Converting floating point to string in non-scientific format

2006-05-01 Thread ernesto . adorio
See also non-exponential floating point representation in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/358361 by R. Hettinger. -- http://mail.python.org/mailman/listinfo/python-list

Re: list*list

2006-05-01 Thread Diez B. Roggisch
> There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? First of all: it's consider

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > Alexis Roda wrote: >> >> > The >> > try block seems nicer because it doesn't have such an ugly-looking >> check >> > to make. >> > > Why do you think that this try block is preferred over what I have (if I > were to stick with the try block)? My example has nothing t

Re: list*list

2006-05-01 Thread Tim Williams
On 1 May 2006 08:28:12 -0700, BBands <[EMAIL PROTECTED]> wrote: There must be a better way to multiply the elements of one list byanother:a = [1,2,3]b = [1,2,3]c = []for i in range(len(a)):c.append(a[i]*b[i])a = cprint a[1, 4, 9] Something like: >>> [ x * y  for x,y in zip(a,b) ] [1, 4, 9

list*list

2006-05-01 Thread BBands
There must be a better way to multiply the elements of one list by another: a = [1,2,3] b = [1,2,3] c = [] for i in range(len(a)): c.append(a[i]*b[i]) a = c print a [1, 4, 9] Perhaps a list comprehension or is this better addressed by NumPy? Thanks, jab -- http://mail.python.org/

Setting a module package to use new-style classes

2006-05-01 Thread Panos Laganakos
Is there a way to have a whole module package use the new-style classes, without having to specify it per module-file or even worse, per class definition? Maybe by declaring the __metaclass__ in the module's __init__.py? -- http://mail.python.org/mailman/listinfo/python-list

Re: returning none when it should be returning a list?

2006-05-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > John Machin wrote: > > > > That's because it "falls off the end" of the function, which causes it > > to return None. However that's not your only problem. Major other > > problem is updating "seed" in situ. > > > I'm not sure what "falls off the end" of the function mea

Re: self modifying code

2006-05-01 Thread Robin Becker
[EMAIL PROTECTED] wrote: > Yes, my implementation was less efficient because of the extra function > call. > >> class Weird(object): >> @staticmethod >> def __call__(arg): >> data = 42 >> def func(arg): >> return arg+data >>

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-04-30, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-04-30, David Lees <[EMAIL PROTECTED]> wrote: >> >>>I want to process large binary files (>2GB) in Python. I have played >>>around with prototypes in pure Python and profiled the code. Most of >>>the time se

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Alexis Roda wrote: > John Salerno escribió: >> 2. Between the if block or the try block, which is more Pythonic? > > Since the command line argument is optional I don't think it should be > considered and exceptional condition if it's missing, so the "if" block > looks better to me. No idea if

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Roel Schroeven wrote: > But watch out with leading backslashes, as in > > subdirs = [r'\cgi-bin', r'\images', r'\styles'] > > os.path.join will assume they are meant to be absolute paths, and will > discard all previous components: > > >>> os.path.join('base', 'subdomain', r'\images') > '\\im

Re: ending a string with a backslash

2006-05-01 Thread John Salerno
Roel Schroeven wrote: > I think this is also the right time to mention os.path.join. Yeah, I ended up using this and it looks a lot nicer too. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: python and xulrunner

2006-05-01 Thread Michel Claveau
Hi! My answer is (perhaps a little) hard, but... I read pages and pages, and traversed sites and sites. Conclusion : - XPcom functions, perhaps, on some special configurations. - xulrunner is an idea (vapor?) But, in production, nothing of all that is usable (for the moment?) -- @-salutati

  1   2   >