pop method question

Alex Martelli aleax at mac.com
Sat Mar 3 21:18:50 EST 2007


Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> wrote:
   ...
> while some_dict:
>     do_something_with(some_dict.pop()) 
> 
> doesn't work. Instead you have to write this:

You have to use .popitem for this -- that's what's it's for...


Alex



More information about the Python-list mailing list