
Sept. 26, 2020
11:14 p.m.
On Sun, Sep 27, 2020 at 8:49 AM Christopher Barker <pythonchb@gmail.com> wrote:
On Fri, Sep 25, 2020 at 11:50 PM Steven D'Aprano <steve@pearwood.info> wrote:
1. We have to pass a sentinel to the setitem dunder if there is no positional index passed.
I still don't follow this logic -- why can't nothing be passed? The dunders either require an index or they don't, would that be just like function calling? So (adapting the example in the PEP:
obj[spam=1, eggs=2] # calls type(obj).__getitem__(obj, spam=1, eggs=2)
Yes, getitem is fine - but look at setitem. ChrisA