[Python-Dev] PEP 342: simple example, closure alternative

Neil Schemenauer nas at arctrix.com
Fri Aug 26 18:33:26 CEST 2005


On Fri, Aug 26, 2005 at 06:21:58PM +0200, Alain Poirier wrote:
> For example, I often use this class to help me in functional programming :
> 
>   _marker = ()
[...]

You should not use an immutable object here (e.g. the empty tuple is
shared).  My preferred idiom is:

    _marker = object()

Cheers,

  Neil


More information about the Python-Dev mailing list