Normally, if one writes a method like this:
def get(self, k, default=None):
one can call it as foo.get('x',2) or as foo('x',default=2).
But not with dict.get. I'm amazed I've never tripped over this before.
(Yes, I appreciate that dict is a builtin class written in C.)
Cheers,
Cameron Sim
On Sat, Sep 12, 2020 at 4:18 PM Cameron Simpson wrote:
>
> Normally, if one writes a method like this:
>
> def get(self, k, default=None):
>
> one can call it as foo.get('x',2) or as foo('x',default=2).
>
> But not with dict.get. I'm amazed I've never tripped over this before.
> (Yes, I apprec