python proxy checker ,change to threaded version
r0g
aioe.org at technicalbloke.com
Mon Dec 7 18:59:28 EST 2009
Rhodri James wrote:
> On Mon, 07 Dec 2009 18:21:23 -0000, Terry Reedy <tjreedy at udel.edu> wrote:
>
>> r0g wrote:
>>
>>> The trick to threads is to create a subclass of threading.Thread, define
>>> the 'run' function and call the 'start()' method. I find threading quite
>>> generally useful so I created this simple generic function for running
>>> things in threads...
>>
>> Great idea. Thanks for posting this.
>>
>>> def run_in_thread( func, func_args=[], callback=None,
>>> callback_args=[] ):
>
> I'm might wary of having mutable defaults for parameters. They make for
> the most annoying errors. Even though they're actually safe here, I'd
> still write:
>
> def run_in_thread(func, func_args=(), callback=None, callback_args=()):
>
> out of sheer paranoia.
>
>
Excellent point, thanks :)
I'm starting to suspect this is the highest quality group in all of usenet!
Roger.
More information about the Python-list
mailing list