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

Mike C. Fletcher mcfletch at home.com
Wed Apr 18 11:37:57 EDT 2001


Yup, I mentioned that in the original article ;) (same with the *args,
**namedargs approaches).  I actually switched to using this:

	class NULLARGUMENT: pass

Then I use the class as the default value for is-checking.
Which I'm told is evil :) .
Mike

-----Original Message-----
From: Alex Martelli [mailto:aleaxit at yahoo.com]
Sent: Wednesday, April 18, 2001 07:01
To: python-list at python.org
Subject: Re: Idiom gone, or did it really ever exist? () is ()
...
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.
...





More information about the Python-list mailing list