On 11/15/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:

> As far as the 'flexible iterator' idea goes, I've had a rough implementation
> of such a beast sitting on my hard drive for the last year and a half (since
> shortly after that January '05 thread I linked to earlier in this discussion).
> My conclusion from writing it was that depending on the implementation choices
> you make in developing the class you will end up in one of two situations:
>
> either 1. The entire iterator is soon loaded into memory as you manipulate it
>
> or 2. The underlying iterator is consumed unexpectedly as you manipulate it

For (2), I'd say it depends on your expectations. If you expect x[:5]
to have always the same semantics you expect from a list, then yes,
you will be surprized if x is an iterator, as you may be surprized if
x is a numpy array. However, it seems contradictory for Python to
insist on specific method semantics, while at the same time is
reluctant to enforce APIs for omnipresent interfaces like sequences
and iterators.

George
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to