Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Damon Timm
On Sun, Dec 7, 2008 at 9:35 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > There is no need to include both the flac file name and the mp3 file > name if the roots match. You can use os.path functions to split the > extension or the quick-and-dirty way: > mp3file = flacfile.rsplit('.', 1)[0] + '.mp

Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Kent Johnson
On Sun, Dec 7, 2008 at 3:10 PM, Damon Timm <[EMAIL PROTECTED]> wrote: > I think I did it! Woo hoo! (cheers all around! drinks on me!) Cool! Where are we meeting for drinks? ;-) > flacFiles = [["test.flac","test.mp3"],["test2.flac","test2.mp3"],\ >["test3.flac","test3.mp3"],["test4.flac

[Tutor] selecting attributes of all elements in numpy arrays

2008-12-07 Thread R. Santos
I have a numpy recarray (rd) with a datetime field (bar_dt) and I want to filter the recarray by year. So far, the only way I've been able to do this is by using rd[np.array([i.year for i in rd.bar_dt])==2008]. Is there a better way to do this? It seems like I must be overlooking something. Th

Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Damon Timm
On Sun, Dec 7, 2008 at 10:47 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > A function as mentioned above would help. For the threaded solution > the function could just start the child process and wait for it to > finish, it doesn't have to return anything. Each thread will block on > its associate

Re: [Tutor] Psyco module

2008-12-07 Thread Kent Johnson
On Sun, Dec 7, 2008 at 12:34 PM, Robert Johansson <[EMAIL PROTECTED]> wrote: > Dear all, I'm trying to get my Python stuff to work on my new computer but I > have problems getting the Psyco module installed. First I tried Python 2.6 > (which worked fine) but discovered that Psyco wasn't prepared fo

Re: [Tutor] try except block for multiple statements

2008-12-07 Thread Kent Johnson
On Sun, Dec 7, 2008 at 12:25 PM, Lie Ryan <[EMAIL PROTECTED]> wrote: > texts = ["a = %s\n" % plan.a, > "b = %s\n" % plan.b, > "c = %s\n" % plan.c, > "d = %s\n" % plan.d >] > > for text in texts: >try: >fo.write(text) >except AttributeError: >

[Tutor] Psyco module

2008-12-07 Thread Robert Johansson
Dear all, I'm trying to get my Python stuff to work on my new computer but I have problems getting the Psyco module installed. First I tried Python 2.6 (which worked fine) but discovered that Psyco wasn't prepared for it. I uninstalled Python 2.6 and when for 2.5.2 instead, but the problem with ins

Re: [Tutor] Tutor Digest, Vol 58, Issue 22

2008-12-07 Thread the New me
That worked, I tried it with string elements also Thanks a bunch --- On Sun, 12/7/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Subject: Tutor Digest, Vol 58, Issue 22 > To: tutor@python.org > Date: Sunday, December 7, 2008, 6:00 AM > Send T

Re: [Tutor] try except block for multiple statements

2008-12-07 Thread Lie Ryan
On Mon, 01 Dec 2008 20:44:20 -0500, Bryan Fodness wrote: > I would like to use a try except to see if a value exists. But, when I > use the following, if a does not exist it exits. I understand why this > does this, but is there a way to get b,c, and d if a does not exist > without using a try e

Re: [Tutor] 'for' loops

2008-12-07 Thread Lie Ryan
On Tue, 02 Dec 2008 01:17:41 +, Alan Gauld wrote: > while loops are used much less in Python than in other languages because > for loops are so powerful. Actually, I think python's for-loop is so powerful that while loop could be removed from the language and no power would be lost (although

Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Kent Johnson
On Sun, Dec 7, 2008 at 8:58 AM, Damon Timm <[EMAIL PROTECTED]> wrote: > On Sun, Dec 7, 2008 at 12:33 AM, Martin Walsh <[EMAIL PROTECTED]> wrote: >> Here is my simplistic, not-very-well-thought-out, attempt in >> pseudo-code, perhaps it will get you started ... >> >> paths = ["file1.flac","file2.fl

[Tutor] Python on 64-bit ...

2008-12-07 Thread Dinesh B Vadhia
I ask this question in trepidation but does anyone have experience of Python on 64-bit Windows Vista - there I said it! Feedback on performance and memory usage would be useful to know. Thanks! Dinesh___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Damon Timm
On Sun, Dec 7, 2008 at 12:33 AM, Martin Walsh <[EMAIL PROTECTED]> wrote: > I'm not certain this completely explains the poor performance, if at > all, but the communicate method of Popen objects will wait until EOF is > reached and the process ends. So IIUC, in your example the process 'p' > runs t

Re: [Tutor] Newbie Wondering About Threads

2008-12-07 Thread Kent Johnson
On Sat, Dec 6, 2008 at 9:43 PM, Damon Timm <[EMAIL PROTECTED]> wrote: > The last piece of my puzzle though, I am having trouble wrapping my > head around ... I will have a list of files > ["file1.flac","file2.flac","file3.flac","etc"] and I want the program > to tackle compressing two at a time .

Re: [Tutor] Sorting on different fields

2008-12-07 Thread Lie Ryan
On Sat, 06 Dec 2008 21:47:16 -0800, the New me wrote: > is there a straightforward example? >>> import operator >>> k = [[1, 2, 3, 4], [4, 3, 2, 1], [1, 3, 2, 4], [2, 4, 3, 1]] >>> sorted(l, key=operator.itemgetter(3, 2)) [[4, 3, 2, 1], [2, 4, 3, 1], [1, 3, 2, 4], [1, 2, 3, 4]] >>> for k in sorte