[Python-Dev]
Re: PEP 336, "Make None Callable", by Andrew McClelland
Anthony Baxter
anthony at interlink.com.au
Thu Nov 4 04:13:33 CET 2004
> Abstract
>
> None should be a callable object that when called with any
> arguments has no side effect and returns None.
My response to this is simply "yuck". This is a hack, abd I
don't think it's worthwhile. If you want to test for None, test
for None. Similarly, if you want a dictionary lookup to default
to a no-op method, there's a perfectly simple way to spell it now:
def defaultNoopMethod(*args, **kwargs): pass
somedict.get(key, defaultNoopMethod)
You can even do this as a one-liner using a lambda if you want.
Anthony
--
Anthony Baxter <anthony at interlink.com.au>
It's never too late to have a happy childhood.
More information about the Python-Dev
mailing list