[Python-3000] Default dict iterator should have been iteritems()
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Thu Sep 6 20:58:41 CEST 2007
Dnia 04-09-2007, Wt o godzinie 11:09 +0200, Georg Brandl napisał(a):
> Even if it's true that a loop over items is more common than a loop over keys,
> "x in keys" is much more common than "x in items".
In my language iterating over dict yields (key,value) pairs, but the
equivalent of "x in dict" checks whether a key is present.
My Kogut<->Python binding is smart enough to convert these conventions
(which needed some work anyway because tuples could not be converted
implicitly between the languages). An ugly part of the conversion was
distinguishing between Python dictionaries, sequences and sets by the
presence of some methods. For the curious, bits of the binding are at
http://kokogut.cvs.sourceforge.net/kokogut/kokogut/lib/Python/Foreign/Python/Collection.ko?view=markup
http://kokogut.cvs.sourceforge.net/kokogut/kokogut/lib/Python/Foreign/Python/KogutObject.ko?view=markup
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list