Re: [Tutor] : Threads?

2005-10-21 Thread Orri Ganel
I'll try doing 3 or 4 tracks per thread, then. Thanks for the advice.If you keep the thread count down to two or three you might get a noticable improvement but one thread per track, unless you havea lot of separate hard disk spindles to distribute the work willnot help much I suspect.Alan G. -- Em

Re: [Tutor] is mxDateTime recommended?

2005-10-21 Thread Tim Peters
[Lance E Sloan] > ... > (I think it's a little too bad that the timedelta class represents all > deltas as days and seconds. And microseconds. > That must be why they don't support months, since months have > different lengths. IMHO...) That's right. It's hard to argue about what days, seconds

Re: [Tutor] is mxDateTime recommended?

2005-10-21 Thread Kent Johnson
Lance E Sloan wrote: > When I add that to another mxDateTime object, the month, hour, and > minute get set to those absolute values, but the month is reduced by > four. I know I won't be able to exactly the same thing with datetime. > I think I could do something like this (semi-pseudocode): >

Re: [Tutor] is mxDateTime recommended?

2005-10-21 Thread Lance E Sloan
--On Thursday, October 20, 2005 4:44 PM -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: > Since 2.3 Python includes a datetime module which has some facility for > date calculations. I think mxDateTime is more sophisticated but if your > needs are simple take a look at datetime. I think I would lik

Re: [Tutor] code improvement for beginner ?

2005-10-21 Thread Kent Johnson
Jacob S. wrote: >> Text mode is the default, you have to specify the 'b' if you want >> binary mode. And open() seems to accept any mode quite happily: >> >> >>> f=open('build.xml', 'rt') >> >>> f >> >> >>> f.close() >> >>> f=open('build.xml', 'rabcd') >> >>> f >> >> >> Kent > > > I'll bet you

Re: [Tutor] : Threads?

2005-10-21 Thread Alan Gauld
> in mind, I thought, why not try to use threads so all the conversions > happen simultaneously? That way, the whole album will take between 30 > and 50 seconds. One possible problem with this is that the activity is disk IO bound. In fact using too many threads could even slow the thing down

Re: [Tutor] self knowledge

2005-10-21 Thread Alan Gauld
Hi Ethan, > When using the class in practice, I've found it natural to > create instances of Foo so that the instance itself is called > name. Thus, I find myself doing things like: > a=Foo('a') b=Foo('b') > This is very common at the interactive prompt. However its nearly always the w

Re: [Tutor] code improvement for beginner ?

2005-10-21 Thread Jacob S.
> Text mode is the default, you have to specify the 'b' if you want binary > mode. And open() seems to accept any mode quite happily: > > >>> f=open('build.xml', 'rt') > >>> f > > >>> f.close() > >>> f=open('build.xml', 'rabcd') > >>> f > > > Kent I'll bet you'll find that open() is coded somet

Re: [Tutor] Can anyone teach me...?

2005-10-21 Thread Jacob S.
>>>I use Delphi for most of my real-world heavy duty GUI work. >>> >> Have you tried Boa Constructor? It is quite similar to Delphi. It builds >> wxPython. > > I tried it a couple of years ago but couldn't get it to work! > > Even if I had it didn't offer many of the features of VB/Delphi such > as

Re: [Tutor] perldoc - confused!

2005-10-21 Thread Danny Yoo
> I spent ages today trying to list all items in a directory, simple I now > know (os.listdir) but I was trying to use os.walk simply because I had > no idea that listdir existed. I only found listdir because I was > reading about walk You should have a 'pydoc' utility. It's also possible t

Re: [Tutor] Help(!) with OOP/Composition from "Learning Python"

2005-10-21 Thread Kent Johnson
Andrew P wrote: > On 10/21/05, Kent Johnson <[EMAIL PROTECTED]> wrote: >>You can also think of classes very pragmatically, as another tool available to >>organize your code, just like modules and functions. > > I realize after all these reposnses that I should have mentioned that I do > use > cl

Re: [Tutor] Help(!) with OOP/Composition from "Learning Python"

2005-10-21 Thread Andrew P
On 10/21/05, Kent Johnson <[EMAIL PROTECTED]> wrote: >For simple examples just look at Python's built in string, list and dict >classes. -Using- OOP isn't the problem :) It's impossible to ignore it's usefulness when programming in Python. But getting from there to thinking non-procedurally is,

Re: [Tutor] : Threads?

2005-10-21 Thread Orri Ganel
Kent Johnson wrote: >Orri Ganel wrote: > > >>Hello all, >> >>I've been working on a program for a week or two now that will convert >>all the wav files in a folder to mp3s, filling the id3 tags with the >>correct information as collected from gracenote.com. This part works >>fine. However,

Re: [Tutor] : Threads?

2005-10-21 Thread Kent Johnson
Orri Ganel wrote: > Hello all, > > I've been working on a program for a week or two now that will convert > all the wav files in a folder to mp3s, filling the id3 tags with the > correct information as collected from gracenote.com. This part works > fine. However, the actual conversion to mp3

Re: [Tutor] self knowledge

2005-10-21 Thread Kent Johnson
Ethan Ligon wrote: > I've devised a simple class; one of the class attributes is an identifier. > > Thus, > > class Foo: > def __init__(self,name): > self.name=name > > When using the class in practice, I've found it natural to > create instances of Foo so that the instance itself is calle

[Tutor] : Threads?

2005-10-21 Thread Orri Ganel
Hello all, I've been working on a program for a week or two now that will convert all the wav files in a folder to mp3s, filling the id3 tags with the correct information as collected from gracenote.com. This part works fine. However, the actual conversion to mp3 takes between 30 and 50 seco

[Tutor] self knowledge

2005-10-21 Thread Ethan Ligon
I've devised a simple class; one of the class attributes is an identifier. Thus, class Foo: def __init__(self,name): self.name=name When using the class in practice, I've found it natural to create instances of Foo so that the instance itself is called name. Thus, I find myself doing thi

Re: [Tutor] Fwd: Saving command line keyed input?

2005-10-21 Thread w chun
On 10/21/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > A quick tip for the Windows command line. > > > > Ctrl-C, Ctrl-A etc don't work, neither does right-clicking > > (menu-click). However, right-clicking does work on the blue title > > bar. > > If you turn on Quick Edit (

[Tutor] perldoc - confused!

2005-10-21 Thread Dan Klose
Hello Python List, When using perl I tend to use perldoc. I spent ages today trying to list all items in a directory, simple I now know (os.listdir) but I was trying to use os.walk simply because I had no idea that listdir existed. I only found listdir because I was reading about walk Is th

Re: [Tutor] greetings...

2005-10-21 Thread Gabriel Farrell
Welcome to the list, Carl. Feel free to browse the list archive at http://mail.python.org/pipermail/tutor/ or http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/python-Tutor to get some idea of the kinds of questions asked and answers given. You'll find a lot of suggestions for beginners among

Re: [Tutor] Fwd: Saving command line keyed input?

2005-10-21 Thread Kent Johnson
Ed Singleton wrote: > A quick tip for the Windows command line. > > Ctrl-C, Ctrl-A etc don't work, neither does right-clicking > (menu-click). However, right-clicking does work on the blue title > bar. > > Right-click on the blue title bar and then go down to Edit and then > you can Select All.

Re: [Tutor] How do I recursively remove the contents of a directory??

2005-10-21 Thread Kent Johnson
Suri Chitti wrote: > If I have a directory /u01/qa/logs and the logs has a number of children > directories and I want to remove everything in logs and logs itself, is > there a single method or command to do that? I want to avoid > recursively removing the files in each child directory and so

Re: [Tutor] Help(!) with OOP/Composition from "Learning Python"

2005-10-21 Thread Kent Johnson
Andrew P wrote: > I've been reading about composition vs inheritance, and went back to > "Learning Python" to look at something I found very confusing a year > ago. Turns out I still find it very confusing :) > > The code at the bottom was taken from the OOP chapter, it's a solution > to one of t

[Tutor] Fwd: Saving command line keyed input?

2005-10-21 Thread Ed Singleton
A quick tip for the Windows command line. Ctrl-C, Ctrl-A etc don't work, neither does right-clicking (menu-click). However, right-clicking does work on the blue title bar. Right-click on the blue title bar and then go down to Edit and then you can Select All. Then right-click on the blue title

Re: [Tutor] How do I recursively remove the contents of a directory??

2005-10-21 Thread Alan Gauld
>If I have a directory /u01/qa/logs and the logs has a number of children > directories and I want to remove everything in logs and logs itself, is os.system('rm -rf %s ' % logpath) Sometimes its easier to use the OS directly! If you were selectively deleting files it would be different but for

Re: [Tutor] Time - sum/difference

2005-10-21 Thread Jonas Melian
I wanted to sum two time values: -02:30 +01:00 -- -01:30 I found one solution: >>> time_local = dt.time(2,30) >>> time_str = str(time_local).split(':') Now I'll can get the first value, convert to integer and sum it. Kent Johnson wrote: >Jonas Melian wrote: > > >>I would get th

Re: [Tutor] Dynamic Function Assignment

2005-10-21 Thread Alan Gauld
for id in ('A', 'B', 'C'): if segment.upper().startswith(id): Think dictionary: objects = {'A': a, 'B':b, 'C':c} for id in ('A','B','C') objects[id].method() I have a section within my OOP topic that specifically talks about this in the context of a collection of bank account objects. Y

Re: [Tutor] regular expression matching a dot?

2005-10-21 Thread Christian Meesters
Hi Frank & Kent & Hugo, Didn't have the time to read the list yesterday ... Thanks for pointing me to the regex-debuggers. Though I don't considered myself a regex-beginner I had to learn, that now that I'm using regexes only occasionally I might need some help here and there. Cheers, Christia

Re: [Tutor] pytunes (Was __slots__, struct, etc.)

2005-10-21 Thread Liam Clarke
Hmmm, that's interesting. Obviously, for a playlist with x songs, and n songs by a particular artist, the optimum separation between songs would be x/n. Which would be easy for one artist, but for all of them? Hmm... Let's see. First off, let's discount all the artists with only one song, they

Re: [Tutor] Help(!) with OOP/Composition from "Learning Python"

2005-10-21 Thread Liam Clarke
On 10/21/05, Andrew P <[EMAIL PROTECTED]> wrote: > I've been reading about composition vs inheritance, and went back to > "Learning Python" to look at something I found very confusing a year > ago. Turns out I still find it very confusing :) > > The code at the bottom was taken from the OOP chapte

Re: [Tutor] How do I recursively remove the contents of a directory??

2005-10-21 Thread w chun
On 10/20/05, Suri Chitti <[EMAIL PROTECTED]> wrote: > > If I have a directory /u01/qa/logs and the logs has a number of children > directories and I want to remove everything in logs and logs itself, is > there a single method or command to do that? I want to avoid recursively > removing the files