[].keys() and [].items() (Was: Why I think range is a wart)

Michael Chermside mcherm at destiny.com
Thu Mar 14 11:26:02 EST 2002


Courageous writes:
> >Question:  Which is better:  items(x) or x.items()?
> 
> Note the question in the PEP, but leave the decision to Guido.
> 
> C//

I disagree. It'e easier for Guido (and everyone else who reads PEPs) if 
the PEPs make a clear and specific proposal instead of listing a whole 
smorgasbord of options. Now if it's a trivial issue, like naming it 
"items" or "indexed", then that's fine. But using items(x) vs x.items() 
is not trivial: there are lots of arguments for or against one that 
don't apply to the other (eg: the need to implement the items() method 
when creating a list-like class).

So to make the PEP process work, the PEP author should try to make these 
decisions, based on input from the community during discussion and on 
the author's own designer intuition. Alternatives that were rejected 
should be noted, but the PEP itself should make a very specific 
proposal. Then the BDFL applies his OWN designer's intuition, combined 
with input from the community.

-- Michael Chermside






More information about the Python-list mailing list