On 3/26/06, Adam DePrince <[EMAIL PROTECTED]> wrote: > I have a draft PEP and an implementation of mutable iterators for lists > and dicts that supports delete only. > > The PEP (Mutable Iterations) and sample code can be found at: > > http://www.deprince.net/ideas/peps.html
I think the PEP really needs a much stronger motivation section, particularly with real-world examples of code that gets improved by the additional methods. The whole discussion was spawned by a request for determining the length of an iterable, a problem which this PEP doesn't solve at all. What problem is this PEP solving? Is there real-world code where this PEP would help out? One of the reasons I'm having trouble imagining it is that especially for lists, code like:: >>> for c in 'abcdefg': ... l.insert( 0, c ) is almost certainly a bad idea performance-wise due to the Python implementation of lists. You don't want to repeatedly insert a single element at the beginning of a list. You'd probably do much better just writing: >>> lst = [] >>> lst.extend(reversed('abcdefg')) >>> lst.extend(l) Performance matters are probably better in the dict-case, but without some compelling real-world examples, this really feels like YAGNI to me. STeVe -- Grammar am for people who can't think for myself. --- Bucky Katt, Get Fuzzy _______________________________________________ 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