On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:

> Paired with a __freeze__ dunder method, this applies to any type, not 
> just sets. (Where appropriate of course.)
> 
> So:
> 
>     |{1,2,3}|       frozen set
>     |[1,2,3]|       tuple!
>     |any-iterable|  tuple!
>     |{1:2, 3:4}|    frozen dict

A frozen "any iterable" is not necessarily a tuple.

For example, a frozen binary tree should probably keep the tree 
structure and methods; a frozen dict.keys() should be a frozen set; and 
its not clear what a frozen iterator should do. Should it run the 
iterator to exhaustion? Seems odd.

What about non-collections? What's a frozen re.MatchObject?


-- 
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/IRISCFVAO3LNT56H7I25NGVS47DCD525/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to