pythonfrozenset

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.


Solution

  • 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