A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-May/073440.html below:

[Python-Dev] nodef

[Python-Dev] nodefBarry 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4