Re: [Python-Dev] [Python-3000] Iterators for dict keys , values, and items == annoying :)

2006-03-31 Thread Taro Ogawa
Taro Ogawa gmail.com> writes: > Nick Coghlan gmail.com> writes: > > There are three big use cases: > > ... > > ... Apologies - this was posted via gmane and the post I responded to appeared in the gmane.comp.python.devel.3000 tree... I'll repost there (and check gmane a little more carefully i

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-30 Thread Taro Ogawa
Nick Coghlan gmail.com> writes: > There are three big use cases: >dict.keys >dict.values >dict.items > Currently these all return lists, which may be expensive in terms of copying. > They all have iter* variants which while memory efficient, are far less > convenient to work with. Is

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-29 Thread Robert Brewer
Nick Coghlan wrote: > There are three big use cases: > >dict.keys >dict.values >dict.items > > Currently these all return lists, which may be expensive in > terms of copying. They all have iter* variants which while > memory efficient, are far less convenient to work with. I'm still

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-29 Thread Nick Coghlan
Nick Coghlan wrote: Darn, I'd hoped I'd caught that in time :( Sorry folks. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://www.boredomandlaziness.org

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-29 Thread Nick Coghlan
Paul Moore wrote: > On 3/29/06, Brett Cannon <[EMAIL PROTECTED]> wrote: >> Without a direct reason in terms of the language needing a >> standardization of an interface, perhaps we just don't need views. If >> people want their iterator to have a __len__ method, then fine, they >> can add it witho

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-24 Thread Guido van Rossum
On 3/24/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > I do find it somewhat interesting that we're considering moving the standard > containers to a more numpy-ish view of the world, though (i.e. one where > multiple mutable views of a data structure are common in order to avoid > unnecessary copyi

Re: [Python-Dev] [Python-3000] Iterators for dict keys, values, and items == annoying :)

2006-03-24 Thread Nick Coghlan
Greg Ewing wrote: > Guido van Rossum wrote: > >> Its maps have methods to >> return keys, values and items, but these return neither new lists nor >> iterators; they return "views" which obey set (or multiset, in the >> case of items) semantics. > >> I'd like to explore this as an alternative to