Identity inconsistency and unification of types and classes

Erik Max Francis max at alcyone.com
Tue Jul 1 00:00:07 EDT 2003


Rim wrote:

> With the great unification of types and classes, what will happen to
> the
> following identity inconsistency?
> 
> >>> class myint(int): pass
> ...
> >>> a=int(1); b=int(1)
> >>> a is b
> 1
> >>> a=myint(1); b=myint(1)
> >>> a is b
> 0

Whether or not int(1) is int(1) is purely an optimization issue, so one
wonders why one would be concerned about it.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ They have rights who dare defend them.
\__/  Roger Baldwin




More information about the Python-list mailing list