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
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to