Sets in Python

thebjorn BjornSteinarFjeldPettersen at gmail.com
Thu Sep 20 04:01:56 EDT 2007


On Sep 20, 9:50 am, thebjorn <BjornSteinarFjeldPetter... at gmail.com>
wrote:

it's bad form to reply to myself, I know, but

>     def __iter__(self):
>         for k in super(mdict,self).__iter__():
>             yield eval(k)

should probably be

    def __iter__(self):
        return (eval(k) for k in super(mdict,self).__iter__())

I'm still getting used to the power of generator expressions :-)

-- bjorn




More information about the Python-list mailing list