Mark Dickinson <[email protected]> added the comment:
[Terry]
> To avoid the intermediate set, [...]
It's not quite as bad as that: there _is_ no intermediate set (or if you
prefer, the intermediate set is the same object as the final set), since the
frozenset call returns its argument unchanged if it's already of exact type
frozenset:
>>> x = frozenset({1, 2, 3})
>>> y = frozenset(x)
>>> y is x
True
Relevant source:
https://github.com/python/cpython/blob/09087b8519316608b85131ee7455b664c00c38d2/Objects/setobject.c#L999-L1003
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46393>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com