call 'the following function' using decorators
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Feb 12 13:05:18 EST 2008
En Tue, 12 Feb 2008 15:20:32 -0200, <castironpi at gmail.com> escribi�:
> I assert it's easier to write:
>
> start_new_thread( this_func )
> def thrA():
> normal_suite()
>
> than
>
> def thrA():
> normal_suite()
> start_new_thread( thrA )
>
> If you don't, stop reading. If you do, accomplish it like this:
>
> @decwrap( start_new_thread, Link, ( 2, 3 ) )
> def anonfunc( a, b ):
> print( a, b )
And I have to *guess* that start_new_thread is called?
A @threaded decorator might be useful, but the above isn't clear at all.
`import this` inside the interpreter.
--
Gabriel Genellina
More information about the Python-list
mailing list