Re: book for a starter

2007-02-27 Thread RickMuller
On Feb 27, 12:08 pm, "Sriram" <[EMAIL PROTECTED]> wrote: > Hi, > > If you have experience programming, just read the online tutorial > athttp://docs.python.org/tut/tut.html > Seconded. It really is a wonderful introduction to Python. Once you've digested that, the Python Library Reference in the

Re: numpy, numarray, or numeric?

2007-02-16 Thread RickMuller
On Feb 15, 11:23 pm, "Frank" <[EMAIL PROTECTED]> wrote: > On Feb 15, 4:40 pm, "Christian Convey" <[EMAIL PROTECTED]> > wrote: > > > I need to bang out an image processing library (it's schoolwork, so I > > can't just use an existing one). But I see three libraries competing > > for my love: numpy,

Re: numpy, numarray, or numeric?

2007-02-15 Thread RickMuller
On Feb 15, 5:40 pm, "Christian Convey" <[EMAIL PROTECTED]> wrote: > I need to bang out an image processing library (it's schoolwork, so I > can't just use an existing one). But I see three libraries competing > for my love: numpy, numarray, and numeric. > > Can anyone recommend which one I should

Re: paseline(my favorite simple script): does something similar exist?

2006-10-15 Thread RickMuller
Amazing! There were lots of great suggestions to my original post, but I this is my favorite. Rick Fredrik Lundh wrote: > RickMuller wrote: > > > I'm posting this here because (1) I'm feeling smug at what a bright > > little coder I am > > if you want to

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread RickMuller
Wow! 6 responses in just a few minutes. Thanks for all of the great feedback! [EMAIL PROTECTED] wrote: > Rick> def parseline(line,format): > Rick> xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} > Rick> result = [] > Rick> words = line.split() > Rick> for i in

paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread RickMuller
One of my all-time favorite scripts is parseline, which is printed below def parseline(line,format): xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} result = [] words = line.split() for i in range(len(format)): f = format[i] trans = xlat.get(f,'None') if

distutils - distributing non-python data files

2005-10-25 Thread RickMuller
I really appreciate the ease that the distutils make distributing Python modules. However, I have a question about using them to distribute non-Python (i.e. text) data files that support Python modules. Currently when I have data of this type, I parse it into python objects and make a python module

Re: Does numarray search for blas and lapack during installation?

2005-04-23 Thread RickMuller
IIRC, no. But the setup.py script is fairly easy to hack to link in your own blas/lapack libraries. -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-06 Thread RickMuller
>> 3. Of what practical use (or even esoteric academic interest) is the >> parity of the number of interchanges? >I presume the goal is academic, determining whether a >permutation is a member of >the alternating group of even permutations (A4, A5, ...). For >some problems, >that is a useful inva

Re: sorting a list and counting interchanges

2005-04-06 Thread RickMuller
Boy, what a snotty answer to a question that had nothing to do with a homework assignment! -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-06 Thread RickMuller
The combinatorics application is very close, since we use A(N) to represent fermions in quantum mechanics. -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-06 Thread RickMuller
Thanks, this will indeed work. I guess I've gotten out of the habit of writing cmp functions since Tim Peter's introduction to the sorting chapter in the first edition of the Python Cookbook convinced me it was inefficient. But the lists should be short here and this should work. -- http://mail.p

Re: sorting a list and counting interchanges

2005-04-06 Thread RickMuller
Well, it's a homework problem in the sense that I happen to be working on it at my home, but, no, I'm not in school anymore. In Quantum Mechanics we use determinants to enforce the Pauli principle, which says that anytime two electrons are exchanged the wave function has to change sign. In most Qua

sorting a list and counting interchanges

2005-04-06 Thread RickMuller
I have to sort a list, but in addition to the sorting, I need to compute a phase factor that is +1 if there is an even number of interchanges in the sort, and -1 if there is an odd number of interchanges. I could write a bubble sort, count the number of interchanges, and compute the factor, but I

Question about the Python Cookbook: How much of this is new?

2005-04-03 Thread RickMuller
I had a question about the second edition of the Python Cookbook. I own and have thoroughly enjoyed the first edition of the Python Cookbook. How much of the second edition is new? Is this "essential reading" if I already have the first edition? I realize that there are new sections that describe l

Re: Help with splitting

2005-04-01 Thread RickMuller
Thanks to everyone who responded!! I guess I have to study my regular expressions a little more closely. -- http://mail.python.org/mailman/listinfo/python-list

Help with splitting

2005-04-01 Thread RickMuller
I'm trying to split a string into pieces on whitespace, but I want to save the whitespace characters rather than discarding them. For example, I want to split the string '12' into ['1','','2']. I was certain that there was a way to do this using the standard string functions, but I just sp

Re: Why is a JIT compiler faster than a byte-compiler

2005-03-24 Thread RickMuller
Thanks for the link. That completely answers my question. -- http://mail.python.org/mailman/listinfo/python-list

Why is a JIT compiler faster than a byte-compiler

2005-03-24 Thread RickMuller
I was talking to a friend of mine about the speed of Python code. One of the questions that came up was why is a JIT compiler like Psyco faster than the Python byte-compiler? I understand why languages like Pyrex are faster, since they set static types that the compiler can use to optimize. But why