[Python-Dev] Re: PEP 279 revisited
Wed, 24 Apr 2002 13:35:10 +0200
On Wed, Apr 24, 2002 at 11:19:18AM +0200, Alex Martelli wrote:
> Of course, if a noun was to be chosen instead, 'enumeration' and
> 'itemization' would be horrid (long and cumbersome), but maybe
> some other alternatives could be more appealing. 'items', for example,
> would be appealing to me personally (by the already mentioned
> "rough analogy" with a dictionary's .items method -- which turns
> others off by being only rough and not exact, so that D.items()
> and items(D) would be different sequences of pairs, albeit with
> similar structures, for just about any dict D).
I would like to transform the 'rough' analogy
into an exact analogy :-)
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):
holds no matter if collection is a list or a dictionary,
would be satisfied, so the analogy is better than 'rough'.
btw, i usually don't need an extra numbering for my dictionaries.
If really in need i would write
list = dict.items()
for index,item in items(list): ...
using the above semantics. Usually i use a list in the first place.
But i am afraid i am too late if this is the final voting...
P.S: As i am new to the list, i introduce myself here.
Mailman told me to :-)
I am using python only for a year or so but it is
clearly the most productive language i have ever encountered.
I am extremely happy to be able participate and
contribute in c.l.py and the dev-list. Code and oppinions!
A very big "thank you" to everyone here!!
Coming from Assembler,c++,java -worlds i am doing lots
of stuff with distributed systems. I am about to release
an open source CORBA Transaction Service in C++ (http://xots.org).
Sometimes i write for german computer magazines CT/iX.
In the latter there will be an article about EuroPython :-)
So much for now, feel free to ask, also in personal mail ...