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

Chris Angelico rosuav at gmail.com
Wed Oct 31 05:41:28 EDT 2018

On Wed, Oct 31, 2018 at 8:24 PM Nicolas Rolin <nicolas.rolin at tiime.fr> wrote:
> As a user I always found a bit disurbing that dict pop method have a default while list and set doesn't.
> While it is way more computationally easy to check wether a list or a set is empty that to check if a key is in a dict, it still create a signature difference for no real reason (having a default to a built-in in python is pretty standard).
> It would be nice if every built-in/method of built-in type that returns a value and raise in some case have access to a default instead of raise, and not having to check the doc to see if it supports a default.

https://www.python.org/dev/peps/pep-0463/ wants to say hi.


More information about the Python-ideas mailing list