On Mon, Aug 31, 2020 at 11:38 AM Guido van Rossum <gu...@python.org> wrote:
> On Sun, Aug 30, 2020 at 11:33 PM Christopher Barker <python...@gmail.com> > wrote: > >> I *think* the trailing comma is shorthand for a larger class of problems. >> That is, in the current system, you can only put a single expression in the >> [], so a comma creates a tuple. Which means that: >> >> i = (a,) >> thing[i] = x >> >> is the same as: >> thing[a,] = x >> >> and >> i = (a, b, c) >> thing[i] = x >> is the same as: >> thing[a, b, c] = x >> >> etc .... >> > > It's not *quite* so simple (though almost so). The parser still treats it > specially, because the slice notation `a:b`, `a:b:c`, (and degenerate forms > like `:` or `::`) are only allowed at the top level. That is, `d[::]` is > syntactically valid, but `d[(::)]` is not. Try it. > Omg. This is a huge problem that I didn't even consider when I wrote my previous reply asking for naked, comma-separated subscript arguments to be disallowed... thanks GvR, for surfacing that one! Yick. <http://python.org/psf/codeofconduct/> It looks like we'd have to snowball many more syntax changes to disallow that. I think I still find myself in the camp of asking for either 3 new dunders or a single new dunder. But it doesn't appear that is the direction things are going. --- Ricky. "I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/CNN35B6QUW5CNVVD6K4FZYZ2XWSLFQHG/ Code of Conduct: http://python.org/psf/codeofconduct/