Please. Use. set().

On Sat, Apr 10, 2021 at 02:03 Serhiy Storchaka <[email protected]> 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 -- [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/ASBHWYDCPR3D2FCVLGPHELPRJUJOWHLL/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 
--Guido (mobile)
_______________________________________________
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/MWBML4BCZ5I3OR2L64JW7WZLZSUTU6GJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to