[Python-Dev] nodef

Barry Warsaw barry at python.org
Thu May 24 02:40:35 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On May 23, 2007, at 8:08 PM, Martin Blais wrote:

> I often have the need for a generic object to use as the default value
> for a function parameter, where 'None' is a valid value for the
> parameter.

I do the same thing for 'get' calls, where None is a legal return  
value.  I often call this unique object 'missing', e.g.

missing = object()
if some_dict.get('foo', missing) is missing:
     # It's missing

I like the way that reads.  Still, I'm -1 on adding something like  
this to built-ins because any built-in could potentially be a value  
in a mapping or a default argument.  Have some super-secret module  
global instantiated just for the purpose prevents that.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQCVAwUBRlTfBHEjvBPtnXfVAQI3kQP6AzYa1VNUIgaqY4aQAW3dUX2sxicEikts
NT6NIo/F676b1P7XYCrN7RA9JYWoyJmMhqrz7EN3SL2dkzd4mcY/XZF/zbY9ph8d
W1SEWo00ImFitSRwngIlUmhlcZimpIQ0Of0hCdm9uK0Cpyk03FXbUelY1LvunJ2T
z8tCQzd8hOw=
=R8bc
-----END PGP SIGNATURE-----


More information about the Python-Dev mailing list