On Wed, 2020-12-16 at 10:01 +0100, Loris Bennett wrote:

> OK, I get the point about when the default value is generated and
> that
> potentially being surprising, but in the example originally given,
> the
> key 'a' exists and has a value of '1', so the default value is not
> needed.

But the function is still called. The get method just doesn't use (or
return) the value it generates because the key exists. Nevertheless,
you're passing the return value of the get_default function as an
argument.

> Thus, I am still unsurprised when dict.get returns the value of an
> existing key.

As am I.

> What am I missing?

You'll need to tell me at this point.

Paul

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to