[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Explanation of list reference

Rustom Mody <rustompmody at gmail.com>:

> But for that Ive to use is
> And as a teacher Ive to explain is
> Might as well use C and get on with pointers
> To me 'is' is a can of worms

I'm not against "is," but it must be carefully defined and taught.

As far as "x is None" is concerned, a key piece of information is
presented on <URL: http://docs.python.org/3.2/library/constants.html>:

    The sole value of the type NoneType.

Unfortunately the page is a bit confusing. It says:

  A small number of constants live in the built-in namespace.

So an essential characteristic of the None object (uniqueness) is
mentioned in the middle of the discussion on the built-in namespace. The
index doesn't contain an entry on NoneType.

Thus, there might still be a nagging concern that a second NoneType
object x such that

   x == None and x is not None

could crop up (from native code, perhaps).