Python 2.4 removes None data type?

Roy Smith roy at panix.com
Fri Mar 4 18:50:14 EST 2005


In article <1109972831.320289.275980 at f14g2000cwb.googlegroups.com>,
 "gaudetteje at gmail.com" <gaudetteje at gmail.com> wrote:

> I just read in the 'What's New in Python 2.4' document that the None
> data type was converted to a constant:
> http://python.org/doc/2.4/whatsnew/node15.html
> 
> """
> # None is now a constant; code that binds a new value to the name
> "None" is now a syntax error.
> """
> 
> So, what's the implications of this?  I find the lack of explanation a
> little puzzling, since I've written code that compares a variable's
> type with the 'None' type.  For example, a variable would be
> initialized to 'None' and if it went through a loop unchanged, I could
> determine this at the end by using a conditional type(var) ==
> type(None).  What will type(None) return now?

Just out of curiosity, *why* did you test against type(None).  What did it 
buy you compared to the simpler var == None'?

In any case, it looks like it does the right thing:

Python 2.4 (#1, Jan 17 2005, 14:59:14) 
[GCC 3.3.3 (NetBSD nb3 20040520)] on netbsd2
Type "help", "copyright", "credits" or "license" for more information.
>>> type (None)
<type 'NoneType'>



More information about the Python-list mailing list