[Python-Dev] Re: PEP 279 revisited

holger krekel pyth@devel.trillke.net
Wed, 24 Apr 2002 16:03:41 +0200

On Wed, Apr 24, 2002 at 08:47:25AM -0400, Guido van Rossum wrote:
> > If you consider lists to be a special dictionary 
> > with implicit keys we can define 'items' to 
> > generate (key,value) pairs for a collection so that 
> > 
> >     for key,value in items(collection):
> >         collection[key]==value 
> > 
> > holds no matter if collection is a list or a dictionary,
> This has been proposed and rejected before.  We've made the decision
> that "iter(dict)" iterates over the keys while "iter(list)" iterates
> over the values, and anything that tries to unify the two types
> (really categories of types: sequences and mappings) is bound to fail.

ok, i am fine with that.

after all i can always define my own 'items' or maybe better 
'keyvalues' method to achieve the unification where needed :-)

regarding PEP279 i go with 'itemize' ...