[Python-Dev] Making None a keyword

Patrick K. O'Brien pobrien@orbtech.com
Fri, 26 Apr 2002 12:11:12 -0500


[Guido van Rossum]
>
> Nothing would change.  None would be a literal keyword, but its value
> in an expression would be the same as before, so None.__class__ would
> work.  Compare "foo".__class__.

>>> ''.__class__
<type 'str'>
>>> [].__class__
<type 'list'>
>>> {}.__class__
<type 'dict'>
>>> True.__class__
<type 'int'>
>>> 2.__class__
  File "<input>", line 1
    2.__class__
              ^
SyntaxError: invalid syntax
>>> 2.2.__class__
<type 'float'>
>>> 2L.__class__
<type 'long'>
>>>

Looks like int is one of the few literals that doesn't allow this. But
floats and longs do. Hmmm. Just FYI. ;-)

---
Patrick K. O'Brien
Orbtech