Re: [Tutor] Decimals 'not equal to themselves' (e.g. 0.2 equals 0.200000001)

2008-08-03 Thread Thomas Pani
CNiall wrote: I want to make a simple script that calculates the n-th root of a given number (e.g. 4th root of 625--obviously five, but it's just an example :P), and because there is no nth-root function in Python I will do this with something like x**(1/n). Side note: of course there are pyt

Re: [Tutor] listing classes

2008-05-20 Thread Thomas Pani
Hi, dir(A) will essentially give you what you want (and a little more) If you're only interested in classes, you can do something like: import types [ name for name in dir(A) if type(eval('A.'+name)) == types.ClassType ] Thomas Laureano Arcanio wrote: Hi All, I need to have a listing of all

Re: [Tutor] Open a directory in the default file manager

2008-05-16 Thread Thomas Pani
Tim Michelsen wrote: > Hello, > is there any function/module that allows me to open a directory in the > default file manager of a operating system? On Windows you can use os.startfile(). On "pure" Unices there's no such thing as filetype associations However, if you use a desktop environment, yo

Re: [Tutor] Question on multithreading

2008-02-24 Thread Thomas Pani
notes on this topic this might be helpful: http://wiki.wxpython.org/LongRunningTasks Cheers, Thomas Pani Varsha Purohit wrote: > Hello, > i have a gui program in wxpython where i am spawning two threads. > one for the mainloop of gui and other for some background tasks. I have >

Re: [Tutor] opening a pipe?

2008-02-12 Thread Thomas Pani
The subprocess module is what you're looking for. Your example would look like %< import subprocess p = subprocess.Popen('cat hi.txt', shell=True, stdout=subprocess.PIPE) for line in p.stdout: print line %< I ass

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Thomas Pani
d time to learn Python. There will be some major changes in 3k, but as long as you don't have to maintain 2.6 and 3.0 in parallel, conversion should be easy enough. Cheers, thomas pani [1] http://docs.python.org/dev/3.0/whatsnew/3.0.html [2] http://www.python.org/dev/peps/pep-3000/ _