Idiom gone, or did it really ever exist? () is ()

Alex Martelli aleaxit at yahoo.com
Wed Apr 18 07:00:43 EDT 2001


"Mike C. Fletcher" <mcfletch at home.com> wrote in message
news:mailman.987583046.24994.python-list at python.org...
> Hmm, checking my code, you are right, the idiom I was actually using (in
one
> very old module still in my codebase, and which still works ;) ) was
> (paraphrased):
>
>     NULL = (1,) # why doesn't () work? Get with it Guido ;)

Why not

    _NULL = []

and then
    def x(y=_NULL):
        if y is _NULL: print "no argument"

i.e., your original trick, but with a _mutable_ object.  This
way it should keep working forever, I believe.


Alex






More information about the Python-list mailing list