pep 336: Make None Callable

Dave Benjamin dave.benjamin at
Thu Nov 4 09:03:21 CET 2004

The Eternal Squire wrote:
>     None should be a callable object that when called with any
>     arguments has no side effect and returns None.

This is how ActionScript works, and to be honest I strongly dislike this 
behavior. It hides bugs, and to make things worse, the null often 
bubbles up someplace entirely different from where the error initially 
occurred. This makes debugging a pain in the ass.

I'd prefer to just write a NullObject if I need one. Otherwise, I like 
Python's behavior, which is more fail-fast and less error-prone. IMHO.

But thanks for putting the idea out. I think Objective C does something 
similar--is this the case? It does have the convenient effect of 
allowing you to pass null as an event listener if you just want to 
ignore events from a GUI object, for instance, but it's just not worth 
the price.


More information about the Python-list mailing list