pep 336: Make None Callable

The Eternal Squire eternalsquire at comcast.net
Thu Nov 4 06:22:18 CET 2004


Terry Reedy wrote:

 > "The Eternal Squire" <eternalsquire at comcast.net> wrote in message 
news:dv6dndASE7CxNBTcRVn-pw at comcast.com...
 >
 >> PEP: 336
 >> Abstract
 >>
 >>    None should be a callable object that when called with any
 >>    arguments has no side effect and returns None.
 >
 >
 >
 > Please no.  The None object, by definition, is an object with no 
value, no behavior (except compares), and no specific attributes (other 
than those common to all descendents of object).


I always saw None not as an object without value, but as the universal
false or ground symbol, similar to NIL in Lisp.

That one can currently compare None

 > to other objects can be considered a bug, and this might go away in 
the future.
 >
 > Anyone who wants a null function can write it in about 20 keypresses, 
and include it in a utility module if one has one.


But isn't the point of Pythonic style to write something as tersely 
elegant as possible?  I'd rather not see a bunch of null methods 
sprinkled thru the classes in the libraries that I have to write, and
I'd rather not to have to import it either.

 >
 > It would be more sensible to promote the addition to builtins of a 
predefined null function -- one somewhat equivalent to 0, [], and {}.
 >

I'd like to see it standardized, and I'd like to see it intuitively 
obvious.  That's why None appears to me to be such an obvious candidate.
If None is seen as the ground symbol that happens to evaluated to false
in logical expressions, that it would seem to make sense to say that
calling the symbol is another form of evaluation of the symbol, and so
if evaluating None as a value results in None, then evaluating None as
a call should also result in None.

 > Terry J. Reedy
 >
 >
 >
 >



More information about the Python-list mailing list