[Tutor] [tutor] list order change

2010-11-26 Thread Michael Sprayberry
You can also sort a list so that is ordered in reverse or alphabetically     Cheers, Michael ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List Changing Order

2010-11-26 Thread Corey Richardson
Steven D'Aprano wrote: Corey Richardson wrote: Tutors, I recall that the keys of dictionaries have arbitrary order, and may change over time. Is this true of lists? I can't find the answer from a simple Google search. Thank you! Only if you re-arrange it yourself. list.sort(), list.reverse

Re: [Tutor] If os.path.lexists() isn't working properly

2010-11-26 Thread Susana Iraiis Delgado Rodriguez
Hello! After all the sugestions I received throught this list; I tried them all and worked ok. At he end I noticed that a single variable change will bring me the results I was looking for. In my code I replaced the line n = os.path.splitext(filename) for: n = os.path.splitext(filepath) p = n[0]

[Tutor] normalize an array

2010-11-26 Thread John
I know this is a simple problem, but I want to do it the most efficient way (that is vectorized...) import numpy as np a = np.array(([1,2,3,4],[1,.2,3,4],[1,22,3,4])) b = np.sum(a,axis=1) for i,elem in enumerate(a): a[i,:] = elem/b[i] suggestions? _

Re: [Tutor] Random Number Question

2010-11-26 Thread Piotr Kamiński
Dnia 25-11-2010 o 13:20:22 Mac Ryan napisał(a): On Thu, 25 Nov 2010 11:09:10 +0100 Timo wrote: > I was wondering... apart from checking each name individually, is > there any easy-peasy way to get a list of names used in the > standard library (I am thinking to something like "dir()"? Th

Re: [Tutor] Random Number Question

2010-11-26 Thread Mac Ryan
On Fri, 26 Nov 2010 18:33:07 +0100 Piotr Kamiński wrote: > You can get the list of Python's standard modules by typing help() > and then you will see something similar to: Thanks a lot! This is what I was after! Mac. ___ Tutor maillist - Tutor@pytho

[Tutor] Consequences of opening subprocesses?

2010-11-26 Thread Cory Teshera-Sterne
Hi all, I'm practicing python by rewriting some bash scripts, and I've found a few things that I can't directly translate, like certain calls to command-line tools. I've figured out how to start them with the subprocess module, but I'm wondering if I'm going to get myself in hot water memory- or p

Re: [Tutor] normalize an array

2010-11-26 Thread Peter Otten
John wrote: > I know this is a simple problem, but I want to do it the most > efficient way (that is vectorized...) > > import numpy as np > > a = np.array(([1,2,3,4],[1,.2,3,4],[1,22,3,4])) > b = np.sum(a,axis=1) > > for i,elem in enumerate(a): > a[i,:] = elem/b[i] > suggestions? I'm no

Re: [Tutor] Consequences of opening subprocesses?

2010-11-26 Thread Alan Gauld
"Cory Teshera-Sterne" wrote I'm wondering if I'm going to get myself in hot water memory- or performance-wise since these scripts are scheduled to run on thousands of files fairly often. It shouldn't be worse than your bash scripts since they implicitly start subprocesses anyway. And if yo

[Tutor] lambda in python

2010-11-26 Thread john tsolox
since in Java i can pass an anonymous class to a function, and this anon class has member functions that can contain a body of implementation codes having the full expression of permissible syntax (if,for,while...), my question is, after seeing various examples of lambda in python being ALL one-l

Re: [Tutor] lambda in python

2010-11-26 Thread Steven D'Aprano
john tsolox wrote: since in Java i can pass an anonymous class to a function, and this anon class has member functions that can contain a body of implementation codes having the full expression of permissible syntax (if,for,while...), my question is, after seeing various examples of lambda in p

[Tutor] %T as a strftime format identifier

2010-11-26 Thread Terry Carroll
Was %T ever a valid format specifier for time.strftime in Python? I just installed a Python streaming MP3 server called Edna (http://edna.sourceforge.net/). It was an easy install except that I got a ValueError on one line, essentially for: time.strftime("%a, %d %b %Y %T GMT") After a few