[Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland

Nick Coghlan ncoghlan at iinet.net.au
Mon Nov 8 10:51:14 CET 2004


Martin v. Löwis wrote:
> The simplest solution to achieve the rationale of the PEP would be
> to add a function operator.nop. Of course, writing
> 
> def nop(*args):pass
> 
> isn't that more difficult than writing
> 
> from operator import nop

Although the def version above has problems with keyword arguments. 
Still, I'd be +0 on

def nop(*args, **kwds): pass

in the operator module, in the spirit of TOOWTDI.

And I meant to add a resounding 'Aye!' to Tim's comment about the 
debugging value of None not being callable - that's an obvious indicator 
of 'I screwed up', whereas silently returning None as proposed in the 
PEP may trigger the error report an arbitrary distance from the original 
mistake.

Cheers,
Nick.

-- 
Nick Coghlan               |     Brisbane, Australia
Email: ncoghlan at email.com  | Mobile: +61 409 573 268


More information about the Python-Dev mailing list