
On 2018-07-23 13:04, Giampaolo Rodola' wrote:
On Mon, Jul 23, 2018 at 3:12 AM Steven D'Aprano <steve@pearwood.info> wrote:
? has no spaces, it's literally "variable names interrupted by question marks" and evaluation can stop at any time while scanning the line from left to right.
Just like ordinary attribute access.
This is the point I was making earlier: you accept existing punctuation doing these things:
try: obj.spam.egsg.tomato.cheese # oops a typo except AttributeError: # evaluation can stop at any time ...
while demanding a higher standard for new punctuation.
All of your criticisms of ? punctuation applies to . as well.
I don't think they do. For once, "a.b" does one and one thing only, "a?.b" does two and that's a fundamental difference (explicitness). It does so by introducing a brand new operator ("?") which can be spelled in two forms ("a?.b" and "a?[b]") by using two adjacent symbols not interrupted by any space, which is an absolute first in the Python syntax and that's the second and fundamental difference. I cannot move the same criticism to the "a.b" form: it's simpler, it does one thing and it uses one symbol.
[snip] I think you're misunderstanding something: we're not talking about a special operator "?" that somehow combines with existing operators, we're talking about completely new and separate operators "?.", "?[", etc., which resemble the existing ".", "[", etc.