[Python-3000] Set literal

Raymond Hettinger python at rcn.com
Sat Jan 26 04:03:58 CET 2008

> should the repr for a set be set({a, b, c}) 
> instead of set([a, b, c])?

FWIW, running eval() on the repr is slower and less memory efficient with curly braces than with the square brackets.

Also, it may be easily misread as meaning: set([frozenset([a, b, c])]).  If the latter is intended, then that would become set({{a, b, c}}) which I find hard to parse correctly.  Maybe the set([a, b, c]) form should live on.


More information about the Python-3000 mailing list