Re: No threading.start_new_thread(), useful addition?

2009-10-10 Thread Laszlo Nagy
Christian Heimes wote: Laszlo Nagy wrote: IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation. You are entitled to your opinion but I STRONGLY recommend against your decorator. You MUST

Re: No threading.start_new_thread(), useful addition?

2009-10-10 Thread Carl Banks
On Oct 9, 3:45 pm, Christian Heimes li...@cheimes.de wrote: Laszlo Nagy wrote: IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation. You are entitled to your opinion but I STRONGLY recommend

Re: No threading.start_new_thread(), useful addition?

2009-10-09 Thread Laszlo Nagy
I personally find it much cleaner this way. Also, why should any code care in which thread it is executed? Why should I have to derive a class from some other only because I want to run one of its functions in a separate thread? I think you are right! Especially that you can (and probably

Re: No threading.start_new_thread(), useful addition?

2009-10-09 Thread Carl Banks
On Oct 8, 5:03 am, Ulrich Eckhardt eckha...@satorlaser.com wrote: sturlamolden wrote: On 8 Okt, 09:17, Ulrich Eckhardt eckha...@satorlaser.com wrote: I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread.

Re: No threading.start_new_thread(), useful addition?

2009-10-09 Thread Christian Heimes
Laszlo Nagy wrote: IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation. You are entitled to your opinion but I STRONGLY recommend against your decorator. You MUST NOT start threads a a side

Re: No threading.start_new_thread(), useful addition?

2009-10-09 Thread Ethan Furman
Christian Heimes wrote: Laszlo Nagy wrote: IMHO it is much cleaner to implement this as a decorator. Pro: transparent passing of positional and keyword arguments, keeps function documentation. You are entitled to your opinion but I STRONGLY recommend against your decorator. You MUST NOT

No threading.start_new_thread(), useful addition?

2009-10-08 Thread Ulrich Eckhardt
Hi! I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then start the new thread on it: t = threading.Thread(target=my_function) t.start()

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Laszlo Nagy
Ulrich Eckhardt írta: Hi! I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then start the new thread on it: t =

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread sturlamolden
On 8 Okt, 09:17, Ulrich Eckhardt eckha...@satorlaser.com wrote: I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then start the new thread on

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Christian Heimes
Laszlo Nagy wrote: But really thread.start_new_thread is better: import thread.start_new_thread as thr thr(my_function,arg1,arg2) Please don't use the thread module directly, especially the start_new_thread function. It a low level function that bypasses the threading framework. The is no

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Ulrich Eckhardt
sturlamolden wrote: On 8 Okt, 09:17, Ulrich Eckhardt eckha...@satorlaser.com wrote: I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Ulrich Eckhardt
Laszlo Nagy wrote: Ulrich Eckhardt írta: Hi! I'm looking at the 'threading' module and see that other than the 'thread' module it doesn't have a simple function to start a new thread. Instead, you first have to instantiate a threading object and then start the new thread on it: t =

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Hendrik van Rooyen
On Thursday, 8 October 2009 13:24:14 Christian Heimes wrote: Laszlo Nagy wrote: But really thread.start_new_thread is better: import thread.start_new_thread as thr thr(my_function,arg1,arg2) Please don't use the thread module directly, especially the start_new_thread function. It a

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Christian Heimes
Hendrik van Rooyen wrote: What does the Threading module buy me, other than a formal OO approach? * the interpreter won't know about your thread when you bypass the threading module and use the thread module directly. The thread isn't in the list of active threads and the interpreter is unable

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Christian Heimes
Ulrich Eckhardt wrote: No, as this one doesn't give me a handle to the thread. I also find this barely readable, for sure it doesn't beat the readability of the proposed function. Roll your own convenient function, though. :) At work we have this short function in our tool box: def