简体   繁体   中英

Is it possible to create frozen sets with curly braces?

It appears that one can only create a frozenset using the frozenset() constructor.

Is this true or is there a textual way to create a frozen set? I can find no evidence one way or the other in the docs .

One sentence above what you linked is the answer (emphasis mine):

Non-empty sets ( not frozensets ) can be created by placing a comma-separated list of elements within braces, for example: {'jack', 'sjoerd'} , in addition to the set constructor.

So in short, no, there is no way to do that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM