> 1) > The long-term proposal in PEP 218 lists a single built-in conversion > function, set(iterable). This made sense when there was a single Set > class, but now this needs to be updated. > > How would instances of a built-in immutable set type be created? > Would there be a second immutable_set() built-in, or would the set() > function take an additional argument: set(iterable, immutable=True)? > -1 on the property version. As it stands now, immutables can be constructed directly from a class with its own methods or, more likely, is an automagically created proxy used internally by mutuable sets. I think of immutable sets as regular sets that are frozen for purposes of inclusion in another set -- there is almost no reason for instantiatiating them directly (other than to save coercion time for sets whose contents are known and fixed at the time of instatiation). > 2) > The PEP proposes {1,2,3} as the set notation and {-} for the empty > set. Would there be different syntax for an immutable and a mutable > set? > > My thought is, "no"; {1,2,3} or {-} is always mutable, and an > immutable set would be written as immutable_set({1,2,3}). That's up > to python-dev, though, but whatever gets chosen needs to be specified > in the PEP. +1. Immutable sets have their own weirdness. No use reflecting that in the core language syntax. Besides, they may yet evolve further (perhaps with an animmutable.refresh() method). Raymond Hettinger
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4