On Thu, Jan 20, 2022 at 3:35 AM Stephen J. Turnbull <
stephenjturnb...@gmail.com> wrote:

> Christopher Barker writes:
>
>  > If this does all come to pass, then:
>  >
>  > s = {3,8,2}.frozen()
>  > will be slightly faster, in some case, than
>  > s = frozenset({3,8,2}
>  >
>  > but the result would be the same.
>  >
>  > There are plenty of tricks to in python to get a touch more performance,
>  > this would just be one more
>  > and frankly pretty rare that it would make an noticable difference at
> all.
>  >
>  > +1 on this
>  > +0 on f{}
>  > -1 on making frozenset a keyword
>
> Stated better than I could, expresses my feelings exactly.  Sticking
> to integers (in floats I'd be less than -0 on f{}), I'll go with
> Chris's ratings, too.
>
> Steve
>

Another agreement with Chris' ratings:

+1 for .frozen()
+0 on f{}
-1 on keyword for frozenset

But that still leaves the literal for the empty set as a problem. I'm still
not sure what I think about {,} as an empty set. I tend to think it looks
like "empty dictionary" and so could be confusing.

Perhaps something like set.frozen() or set().frozen() could be optimized?

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
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/VQANC4SH4VII6F5Y35SWWF5YKVHG4JN2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to