On Thu, Aug 19, 2021 at 11:27 PM Matsuoka Takuo <motogeom...@gmail.com> wrote: > > Dear Steve, > > Thank you for your detailed explanation. > > > > (i.e., it can be mistyped as "s[1,2,]" but without SyntaxError this > > > time). It would at least be consistent if we got SyntaxError in > > > both cases (namely, the syntax allowed only a single Python > > > expression here), but if we don't want SyntaxError in the latter > > > case, how may we want it in the former case? > > > > I defy you to explain how the compiler or interpreter can distinguish > > any of those stipulated programmer errors from intended programs. > > Sure, if you ever want any error raised in those cases, that's going > to be SyntaxError to be always raised regardless of the > programmer's intention. That's fine. But then if you don't want > SyntaxError in the "latter" case, it in fact means you never want > any error raised since SyntaxError is the only thing you could > hope for anyway. So I could equivalently have asked "if we never > want any error raised in the latter case, how may we want some > error raised at least sometimes in the former case?". This may > have been clearer to you, but it's an equivalent question. > > Anyway, I assume everything you say about "*(1,2)" is right, but it's > not "*(1,2)" that I wanted to create > an object, but, as I have indicated, it's things like "*iterable , " > (with comma!), where the iterable may be "(1,2)". Just as in "1,2", > the comma indicates the intention to create an object. For example, > > >>> *(1,2), > (1, 2) > > and another example: > > >>> *(), *(1,2) > (1, 2) > > I find it unfortunate SyntaxError you got with > > >>> *(1,2) > > says "can't use starred expression here" since "*(1,2)" is not really > a "starred expression" as defined in the Language Reference. I think > this should be fixed, so have started a new thread on that, titled > '''SyntaxError says: "can't use starred expression here", but its not > the same "starred expression" defined in the Language Reference''', > You are invited to comment on that!
Is the issue just one of wording in the exception message, or are you asking for a change of functionality? In your final example, you've never said that you're creating a tuple, so it's correct to get a SyntaxError. I'm confused as to whether you're asking for this to have meaning, or if instead you are simply proposing a change to wording. Changes to wording can definitely be done, and aren't a major backward or forward compatibility concern. ChrisA _______________________________________________ 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/YCT4EQAABSDAHIQ65NXQZI3SSC6FKNV7/ Code of Conduct: http://python.org/psf/codeofconduct/