Identity inconsistency and unification of types and classes

Michael Hudson mwh at python.net
Mon Jul 14 07:15:50 EDT 2003


rimbalaya at yahoo.com (Rim) writes:

> Hi,
> 
> 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

Nothing, as is.  You can always dick about in myint.__new__ if you
really want to manage that, but as others keep saying, you shouldn't
worry about it too much.

Cheers,
M.

-- 
  My hat is lined with tinfoil for protection in the unlikely event
  that the droid gets his PowerPoint presentation working.
                               -- Alan W. Frame, alt.sysadmin.recovery




More information about the Python-list mailing list