Long integers, xrange and number theory

Martin v. Löwis martin at v.loewis.de
Sat Dec 7 15:44:42 EST 2002


Mark Edward Tristan Dickinson <dickinsm at umich.edu> writes:

> Is this necessarily true?  Couldn't the implementation check to see
> whether both arguments are `short' ints, return an efficient xrange
> object if so, and a less efficient one otherwise?  This would seem
> more in keeping with the idea of the int/long unification.

That would indeed be an implementation strategy. Contributions in that
direction are welcome.

> No real problem, but it's less than ideal: when someone reading code
> encounters generate_range() it's not immediately clear what it means,
> in contrast to xrange() which has an immediate meaning to someone who
> knows Python.  

I see. You might want to call it xxrange then.

> I guess that generate_range() is also less efficient than xrange()
> would be, though this doesn't bother me as much.

That remains to be seen.

Regards,
Martin



More information about the Python-list mailing list