Please. Use. set().

On Sat, Apr 10, 2021 at 02:03 Serhiy Storchaka <storchaka@gmail.com> wrote:
09.04.21 19:08, micro codery пише:
>
>     You can now use `{*()}` as a syntax for empty set.
>
> I saw that in the ast module and think it's clever, mainly in a good
> way. I don't think it is the same as having dedicated syntax for the
> empty set partly because I think it needs to be taught. I don't think a
> new pythonista would turn to empty tuple unpacking to get the empty set,
> where I do think that either set() or {,} would be natural, at least
> after some trial and exceptions.

Do you think that {,} does not need to be taught? It is a new special
syntax which needs paragraphs in tutorial and language reference. In
contrary, {*()} is a simple combination of already described syntax
elements.

> It also doesn't give quite the
> optimization as {,}.

It is a trivial optimization. It was not implemented yet only because
such code is never used in tight loops, empty set creation is very rare
operation at all. We prefer to keep the compiler simpler and focus on
optimizing common operations which has significant effect.

_______________________________________________
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/ASBHWYDCPR3D2FCVLGPHELPRJUJOWHLL/
Code of Conduct: http://python.org/psf/codeofconduct/
--
--Guido (mobile)