range or xrange disallowed for big numbers

Martin v. Loewis martin at v.loewis.de
Fri Oct 4 18:15:35 EDT 2002


Chad Netzer <cnetzer at mail.arc.nasa.gov> writes:

> Is there a reason (technical or philosophical) to disallow:
> 
>     range( 10000000000L, 10000000000L + 1L )
> 
> or 
> 
>     xrange( 10000000000L )
> 
> etc...?

A technical reason. A range object is defined as

typedef struct {
	PyObject_HEAD
	long	start;
	long	step;
	long	len;
} rangeobject;

Changing it would be a medium-sized object, and cost performance in
the common case.

Regards,
Martin




More information about the Python-list mailing list