[Python-3000] sets in P3K?

Greg Wilson gvwilson at cs.utoronto.ca
Fri Apr 28 14:09:24 CEST 2006


OK, OK, just so I can get it off my chest:

- introduce '@' as a prefix operator meaning 'freeze'.

- [1, 2, 3] is a mutable sequence (our old friend the list)

- {1, 2, 3} is a mutable set

- @{1, 2, 3} is an immutable set (i.e., a frozen set --- frozen
  at creation, so all current optimizations possible)

- @[1, 2, 3] is an immutable sequence (i.e., a tuple)

Now, if only I can figure out whether "@x" means "bind the name x
permanently to its current value to create a symbolic constant" or "freeze
the object to which x currently refers"... ;-)

Thanks,
Greg


More information about the Python-3000 mailing list