[Python-Dev] redefining is

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Mar 18 18:37:03 EST 2004


> There is an idiom (I've seen it more in Lisp than in python) 
> of creating a fresh object to act as a sentinel.

I find it extremely rare that None isn't sufficient for this kind of
thing in Python. It may be more common in Lisp due to the fact that
Lisp's equivalent of None is indistinguishable from an empty list...

In those rare cases where None is also a legitimate value, it's not
hard to manufacture some unique object and test for it with 'is'. You
just have to remember that strings and integers are not necessarily
unique, which I don't think is too hard to keep in mind.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list