When is an int not an int? Who can explain this?

Charles T. Smith cts.private.yahoo at gmail.com
Mon Jan 18 11:11:12 EST 2016


$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> type(0) is int
True
...
(PDB)type(0) is int
False
(PDB)type(1) is int
False

(PDB)p 5 + 0
5

(PDB)class c (object): pass
(PDB)type (c()) is c
True






More information about the Python-list mailing list