On Sun, Jan 16, 2022 at 3:14 PM Paul Moore <p.f.mo...@gmail.com> wrote:

> I may just be reiterating your point here (if I am, I'm sorry - I'm
> not completely sure), but isn't that required by the definition of the
> frozenset function. You're calling frozenset(), which is defined to
> "Return a new frozenset object, optionally with elements taken from
> iterable". The iterable is the (non-frozen) set {1, 2, 3}.
>

Exactly.

In a way, what this might do is open the door to  interning (some) frozen
sets, like cPython does for some ints and strings.

But that's only helpful is they are very heavily used, which they are not.

And I'm sure a way to intern them could be done without a literal anyway.

(using f{...} as a frozenset literal) does something different - it
> returns the *same* object, compiled once at function definition time,
> every time it's called.
>

why/how would it do that? It *could* do that -- as above, with interning.
but:

def fun():
    return "some string"

doesn't return the same string, unless it's iterned, which is an
implementation detail, yes?

Stephen -- I'm going to paraphrase you now:

We don't make changes to Python syntax unless there is a compelling reason.

I'm really lost on what the compelling reason is for this one?

There are any number of python types with no "literal" (well, not any
number, it's quite defined. but still) heck, we don't even have literals
for Decimal. Why this one?

-CHB
---
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
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/MO2YMAV254EAOSUFHIRETB3TSOJSJW3G/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to