On 21Jan2022 01:16, MRAB <[email protected]> wrote:
>On 2022-01-21 00:18, Cameron Simpson wrote:
>>This all feels to me like a special case of "wanting a constant for
>>bytecode". What is we had a "freeze" operator, eg:
>> |foo|
[...]
>>Paired with a __freeze__ dunder method, this applies to any type, not
>>just sets. (Where appropriate of course.)
>> |{1,2,3}| frozen set
>> |[1,2,3]| tuple!
>> |any-iterable| tuple!
>> |{1:2, 3:4}| frozen dict
[...]
>>My main question is: is the syntax unambiguous?
>>
>I don't know whether it's unambiguous, but it could be confusing.
>
>For example, what does this mean:
> | a | b |
>?
Yeah.
>It's:
> | (a | b) |
>I think.
Probably. Running precedence the other way (or even worse, letting the
valid combinations just shake out) would be confusing.
>The problem is that '|' could be an opening '|', a closing '|', or an
>infix '|'.
>
>You don't get this problem with differing open and closing pairs such
>as '(' and ')'.
Yes, but have you _seen_ the bickering about the existing bracket
choices just for frozenset? Eww. Hence the going for a distinct operator
altogether. Yes, I'd prefer brackets of some kind too, but they're
taken.
Cheers,
Cameron Simpson <[email protected]>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/FZN74PZJBZCLULMT5AMTT6MP2L6RCENP/
Code of Conduct: http://python.org/psf/codeofconduct/