Pop a list from beginning ? and memory saving...
pyth at devel.trillke.net
Wed Jun 19 20:33:25 CEST 2002
Michael Chermside wrote:
> As for the original question (is it a good idea), I'd say YES, but with
> one caveat. I think that it is important that the "iterable" utilities
> operate on ANY iterator ... and that isn't possible with the intelligent
> implementation of reverse. So I think that if iterable.reverse() were to
> check the type of it's argument and use the clever approach (counting
> backwards) for types list and tuple, but fall back on creating a temp
> list and reversing it for other types, then that'd be quite useful.
> Optimize the common case, but don't lose the universality.
i completly agree. Iterators in an iterators module should work
with any iterator. And reverse iterators are not really a brand
new invention, as anyone using the C++-STL stuff knows.
i-am-sure-lisp-always-had-it-ly y'rs, holger
More information about the Python-list