lazy evaluation in Python

Tim Peters tim_one at email.msn.com
Sat Sep 9 14:22:40 EDT 2000


[Bryn Keller]
> ...
> One interesting question I've run into in trying to create a
> general-purpose lazy tuple class is slicing. In python, if you
> write foo[3:], what gets sent to __getslice__ is 3, sys.max_int.
> What will happen to that when Python supports longs as sequence
> indices?

Download Python 2.0b1 and find out today <wink>.  (3, sys.maxint) still gets
passed.  Huge explicit bounds are clipped to fit in the platform's Python
small-int (== C's long int) range.  There's really nothing else that can be
done that's backward compatible, so it will stay that way until P3K -- and
perhaps even then.  Guido probably views passing giant ints to the sequence
protocol as a form of jerking off anyway <0.9 wink>.

master-of-deflecting-the-blame-ly y'rs  - tim






More information about the Python-list mailing list