surprise: dict.get's default is a positional only parameter!

2020-09-11 Thread Cameron Simpson
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

Re: surprise: dict.get's default is a positional only parameter!

2020-09-11 Thread Chris Angelico
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