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 | christian.heimes |
|---|---|
| Recipients | christian.heimes, gvanrossum, jyasskin, nnorwitz |
| Date | 2008年01月08日.17:02:03 |
| SpamBayes Score | 0.010817138 |
| Marked as misclassified | No |
| Message-id | <1199811725.33.0.688326867199.issue1762@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
__instancecheck__ contains unnecessary code. If we restrict ABCs to new
style classes we could make the function faster:
Old:
def __instancecheck__(cls, instance):
"""Override for isinstance(instance, cls)."""
return any(cls.__subclasscheck__(c)
for c in {instance.__class__, type(instance)})
New:
def __instancecheck__(cls, instance):
"""Override for isinstance(instance, cls)."""
# safe a function call for common case
if instance.__class__ in cls._abc_cache:
return True
return cls.__subclasscheck__(instance.__class__) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年01月08日 17:02:05 | christian.heimes | set | spambayes_score: 0.0108171 -> 0.010817138 recipients: + christian.heimes, gvanrossum, nnorwitz, jyasskin |
| 2008年01月08日 17:02:05 | christian.heimes | set | spambayes_score: 0.0108171 -> 0.0108171 messageid: <1199811725.33.0.688326867199.issue1762@psf.upfronthosting.co.za> |
| 2008年01月08日 17:02:04 | christian.heimes | link | issue1762 messages |
| 2008年01月08日 17:02:03 | christian.heimes | create | |