__iadd__ and fellows missing (Python 2.2)

Terry Reedy tejarex at yahoo.com
Sat Apr 13 17:01:41 EDT 2002


"Mike C. Fletcher" <mcfletch at rogers.com> wrote in message
news:mailman.1018723227.15055.python-list at python.org...
> I was unaware that there was no guarantee for 0-length tuples always
> being unique objects.  There are lots of places in my code where I
use
> 0-length tuples in this pattern:
>
> NULL = ()
>
> class A:
> def b( self, object=NULL ):
> if object is NULL:
> #was not specified
> elif object is None:
> #specified to be object None
>
> Of course, I can use:
>
> NULL = []
>
> But I'd always avoided that because of bad associations with having
> mutable objects as default parameters (yes, it doesn't actually
matter
> in this pattern, but it's a thirty-times-burned-thirty-first-shy
thing).
>   Suppose I'll wind up using singleton instances instead.

Given that None is a possible input, so it cannot be used as the
no-input flag, you could also try something like NULL="OpTioNaL ArG
NoT GiVeN"

Terry






More information about the Python-list mailing list