Behaviour of pop() for dictionaries
Cameron Simpson
cs at cskk.id.au
Tue Jun 15 04:18:48 EDT 2021
On 14Jun2021 09:39, BlindAnagram <blindanagram at nowhere.org> wrote:
>However, d.pop(key, [default]) returns the value (or the default) and
>consistency with other pops (a good thing in my view) would suggest
>that d.pop() could return a random value, which would serve my purpose
>when there is only one element.
If you don't care what key was popped, maybe you want a set and not a
dict?
Just a thought.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list