On Sun, Jan 16, 2022 at 04:50:40PM +0000, MRAB wrote: > Not quite as bad as that: > > >>> f = frozenset({1, 2, 3}) > >>> f is frozenset(f) > True
Mark suggested that on the bug tracker too, but that's not relevant. As I replied there: >>> def f(): ... return frozenset({1, 2, 3}) ... >>> a = f.__code__.co_consts[1] >>> a frozenset({1, 2, 3}) >>> b = f() >>> assert a == b >>> a is b False Each time you call the function, you get a distinct frozenset object. -- Steve _______________________________________________ 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/RMPLHFYH2SH6LCYCKGTY6V3ME4NCCAWO/ Code of Conduct: http://python.org/psf/codeofconduct/