pop method question

Alex Martelli aleax at mac.com
Sun Mar 4 03:18:50 CET 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