[Python-Dev] Propose to reject PEP 336 -- Make None Callable

Raymond Hettinger raymond.hettinger at verizon.net
Fri Jun 17 08:55:26 CEST 2005

After nine months, no support has grown beyond the original poster.  The
PEP did however generate some negative responses when brought-up on
comp.lang.python (it made some people's stomach churn).

The PEP fails the tests of obviousness and necessity.  The PEP's switch
example is easily handled by replacing the callable None with a simple,
null lambda:

   def __call__(self, input):
      return {1 : self.a,
              2 : self.b,
              3 : self.c
             }.get(input, lambda *args: 0)(input)

The PEP does not address conflicts with other uses of None (such as
default arguments or indicating values that are not applicable).
Mysteriously, the PEP consumes only *args but not **kwargs.

It also fails with respect to clarity and explicitness.  Defining a
short, explicit default function is a hands-down winner in these two
important measures of merit.


More information about the Python-Dev mailing list