This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Rosuav
Recipients Devyn Johnson, Rosuav
Date 2015-12-18.14:56:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450450604.14.0.407131760295.issue25903@psf.upfronthosting.co.za>
In-reply-to
Content
The trouble with that example is that the semantics aren't the same. The isinstance check will also be true for subclasses of int (for instance, isinstance(True,int) is True), but the equality check will catch only exact matches. And that's even before considering that anything can be overridden - the name 'type' or 'int' might have been rebound, or the type object might have an __eq__ method, etc, etc.

If you want to look into CPython optimization, hang out on the python-dev mailing list (and read its recent archives); there's a current project called "FAT Python" which does a lot of changes of this nature, and it has to cope with certain questions (like "what if this has been rebound?"). This isn't a simple problem, but it's one people are looking into.
History
Date User Action Args
2015-12-18 14:56:44Rosuavsetrecipients: + Rosuav, Devyn Johnson
2015-12-18 14:56:44Rosuavsetmessageid: <1450450604.14.0.407131760295.issue25903@psf.upfronthosting.co.za>
2015-12-18 14:56:44Rosuavlinkissue25903 messages
2015-12-18 14:56:43Rosuavcreate