Looking for info on Python's memory allocation

Delaney, Timothy (Tim) tdelaney at avaya.com
Wed Oct 12 00:42:36 CEST 2005


Fredrik Lundh wrote:

> Alex Martelli wrote:
> 
>> (there is no common Python type on which you can both call
>> len(...) AND the .next() method, for example -- a combination
>> which really makes no sense).
> 
>>>> L = [1, 2, 3]
>>>> len(L)
> 3
>>>> I = iter(L)
>>>> I
> <listiterator object at 0x0091ABD0>
>
> (it's probably not a good idea to rely on this behaviour...)

Absolutely not - this has recently been discussed on python-dev, and
Guido regrets that __len__ is exposed on any of the built-in iterators.
This behaviour may well change in future versions.

Tim Delaney



More information about the Python-list mailing list