[Python-Dev] Type of range object members
"Martin v. Löwis"
martin at v.loewis.de
Wed Aug 16 08:28:13 CEST 2006
Greg Ewing schrieb:
>> There isn't? Actually a lot of APIs currently assumen that.
>
> Also it means you'd pay a penalty every time you
> access it, whereas presumably short ints are the
> case we want to optimise for speed as well.
That penalty is already paid today. Much code dealing with
ints has a type test whether it's an int or a long. If
int and long become subtypes of each other or of some abstract
type, performance will decrease even more because a subtype
test is quite expensive if the object is neither int nor
long (it has to traverse the entire base type hierarchy to
find out its not inherited from int).
Regards,
Martin
More information about the Python-Dev
mailing list