[Python-ideas] Python docs: page: In what ways in None special
Chris Barker - NOAA Federal
chris.barker at noaa.gov
Wed Aug 15 12:02:24 EDT 2018
> None is keyword, and just like any other keyword, it can't be re-bound.
>> it's only a keyword because Python doesn't otherwise have a way of creating non-rebindable names. It's purpose is to represent the singular object of NoneType, and in that sense it's a literal as much as [] or "".
We’re getting kind of pedantic here, but no, it’s not “as much as” —
[] and “” create new instances of a list or string.
For the purposes of this document, however, these are pretty esoteric
distinctions.
What the docs should make clear is that None ( and True and False ) is
a singleton— None will always refer to the SAME None object.
And that can be demonstrated by showing that you can’t rebind the name None.
But I think it’s misleading to say that that is the same as:
42 = “something else”
None is syntactical a name like any other — what’s special about is
that it can’t be rebound.
-CHB
>
> --
> Rhodri James *-* Kynesim Ltd
More information about the Python-ideas
mailing list