
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.
If one uses prefixes, you start from 53 valid (all latin areas, upper,
lower and @) new brackets for {} . I can't see how they are "all taken" when the strongest argument against prefixing seems to be "but _only strings_ should have prefixes". (with the "typing f{} instead of f() is going to be a bug magnet" as a runner up). None of those stand up to any logical analysis It is ok voting that "the language should not be made more complex at this point, and we won't add any new syntax for a frozenset", but I think that if it is agreed that frozensets are ok, a prefix is just straightforward. And then, adopting prefixes for curly braces, you have 52 other bracket types to try and sell this "generic freezer operator" you are presenting here. :-). On Fri, Jan 21, 2022 at 5:52 AM Cameron Simpson <cs@cskk.id.au> wrote:
On 21Jan2022 01:16, MRAB <python@mrabarnett.plus.com> 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 <cs@cskk.id.au> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/FZN74P... Code of Conduct: http://python.org/psf/codeofconduct/