Chris Angelico writes:

 > Using popitem mutates the underlying dict. That's a tad more likely
 > to affect other parts of the code.

Granted.  The context is opposition to itertools.first.  "Advocating"
popitem is tongue-in-cheek, with the serious point is that it's
obvious that it alters state from the name (at least if you have any
knowledge of data structures).  You can restore the state trivially
(OK, race condition, yadda yadda).

Neither is true of itertools.first.  It's neither obviously
destructive from the name, nor is it necessarily possible to restore
state.

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4V2P4WLLUM7RTVQUX5XWXKXNKBGRG2H5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to