efficiency of range() and xrange() in for loops

Fredrik Lundh fredrik at pythonware.com
Sun Apr 9 16:02:26 EDT 2006


Alan Morgan wrote:

> >How would xrange(100).remove(1) work?
>
> One way is by first converting the xrange to a list.  If we think of
> the xrange as an efficient and space lean way to store certain types
> of lists then it isn't unreasonable to return a regular list when
> the conditions no longer hold.

do you understand Python's object model to be able to suggest how such
a conversion could be done, or is that someone else's problem ?

</F>






More information about the Python-list mailing list