On Tue, 1 Feb 2022 at 09:02, Cameron Simpson <c...@cskk.id.au> wrote:
>
> [... big snip...]
>
> On 22Jan2022 01:41, Chris Angelico <ros...@gmail.com> wrote:
> >On Sat, 22 Jan 2022 at 00:56, Joao S. O. Bueno <jsbu...@python.org.br> wrote:
> >> At that point, I argue that despite adding still more things to
> >> the syntax, it is one that will spare time in average than the other
> >> way around, due to the time people, needing frozensets for
> >> the first time in any project, waste looking for a literal syntax for them
> >> only to find out there is not any.
> >
> >Have you any stats on this? There is no literal/display syntax for
> >datetimes, regular expressions, ranges, bytearrays, or a host of other
> >common types. How often do people reach for a literal syntax for
> >those? (I say "literal/display" since, technically, dicts have a
> >display syntax, not a literal, and complex numbers are written as a
> >constant-folded sum, but in practical terms, those count. The other
> >types don't even get that.) If frozensets are so special that they
> >need syntax, why not ranges, which are used far more frequently?
>
> Well, some data.
>
> a) if the, for example, f{constant-set-display} syntax is generalisable
> (notionally, where we generalise it or not), it offers a path to frozen
> literals for other things via a prefix notation, should be become
> desirable.
>
> b) literal regexps: people use these _all the time_, conceptually.
>

In other words: If we create literals for a bunch of different things,
then frozensets would be neat, but if we don't, then other types
should have priority. Is that correct?

I'm of the opinion that range objects should get literal syntax before
frozensets do. You're of the opinion that regexps should get literal
syntax before frozensets do. We're broadly in agreement here.

I would *much* rather see {1,2,3}.frozen() be constant-foldable than
f{1,2,3} as a literal.

(That said: I'm actually not convinced that regexps need literal
syntax, because it wouldn't benefit alternate regexp engines on PyPI.)

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/NUU3TDWKRF4OMH6UFPEJCYG2BY6OSO52/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to