[Python-ideas] Add "default" kwarg to list.pop()

Serhiy Storchaka storchaka at gmail.com
Thu Nov 1 15:36:19 EDT 2018


31.10.18 13:07, Antoine Pitrou пише:
> l.pop(default=...) has the potential to be multi-thread-safe, while
> your alternatives haven't.

The multi-thread-safe alternative is:

     try:
         value = l.pop()
     except IndexError:
         value = default



More information about the Python-ideas mailing list