On Tue, Apr 1, 2008 at 9:37 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > I think it's fairly obvious why the 2.x .keys() has to change. It's > just too wasteful to actually build the list of all keys of a dictionary > (or even of all values, as you have to create all the tuples as well), > if all you want to do is to iterate over it, and the most common > operation of .keys() is to iterate over it in a for look (right?).
I don't think so. Is this a use case for d.keys()? Why not just write "for k in d"? To me, framing the question as "iterate vs. copy" seems bogus. It's more like "view vs. copy". The thing is, copying provides the semantics I want (of *course* I don't want extra helpings of aliasing and spooky interaction between collections, are you nuts?), and the slowness has never bothered me--that I know of. Views would be faster, but with silently different semantics. I think I want copying. -j _______________________________________________ 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