On Thu, 2006-11-16 at 08:03 -0800, [EMAIL PROTECTED] wrote:
>   @atexit.register
>   def goodbye():
>       print "Goodbye, terminating..."
> 
> 
> However, there is one fundamental problem with this: atexit.register()
> returns None. Since the above code corresponds to::
> 
> 
>   def goodbye():
>       print "Goodbye, terminating..."
>   goodbye = atexit.register(goodbye)
> 
> the code registers goodbye but right after it binds goodbye to None!

While it wouldn't hurt to have atexit.register return the function it
registered, this "problem" is only a problem if you wish to call the
function manually, since atexit already registered the reference to the
intended function before your reference to it gets rebound to None.
Normally one would register a function with atexit precisely because
they don't want to call it manually.

-Carsten


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to