When to use None

Aahz Maruch aahz at netcom.com
Sun Feb 6 23:15:18 CET 2000


In article <m3wvojx0ie.fsf at atrus.jesus.cam.ac.uk>,
Michael Hudson  <mwh21 at cam.ac.uk> wrote:
>
>I guess the point is that I can't think of a good reason for an object
>to masquerade as None.  I generally use None to mean exactly that; a
>void, nothing (like nulls in SQL, I guess).

Yes, exactly (referring to your second sentence).  What, then, is the
proper behavior for an object that one wishes to have a null value?  It
could be argued that the proper behavior is to change the reference to
None and instantiate a new object whenever there *is* a value, but I
think that's a bit limiting, particularly if one considers such aspects
as efficiency and orthogonal behavior in a list.

This goes double if one wants the *object* to distinguish between zero
and None.
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Have a *HAPPY* day!!!!!!!!!!



More information about the Python-list mailing list