Idiosyncratic python

Paul Rubin no.email at nospam.invalid
Thu Sep 24 02:16:02 EDT 2015


Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
> for k, v in mydict.items(): 
>     del(k)

That looks wrong: it's deleting k from what?

> instead of the more obvious
> for v in mydict.values(): 
>     ...

Maybe you mean

   while mydict:
      k, v = mydict.popitem()
      ...



More information about the Python-list mailing list