[Python-Dev] Re: PEP 336, "Make None Callable",
by Andrew McClelland
Carlos Ribeiro
carribeiro at gmail.com
Sun Nov 7 18:00:26 CET 2004
On Thu, 04 Nov 2004 14:13:33 +1100, Anthony Baxter
<anthony at interlink.com.au> wrote:
>
> > 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.
Just a question, and I sincerely hope it's not a dumb one. Python
already have a noop statement ("pass"). Now, what is being requested
is a standard noop callable. Does it make sense -- both in
theorethical and practical terms -- to allow a statement such as
"pass" to be used in both situations? In other words, does it make
sense to have a "unification" of sorts?
Thanks for any pointers,
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com
More information about the Python-Dev
mailing list