title: ast.literal_eval() support for set literals in Python 2.7?
body: <p>In the <a href="http://docs.python.org/whatsnew/2.7.html#python-3-1-features" rel="nofollow noreferrer">What’s New in Python 2.7</a> document it says that support for set literals was back-ported from Python 3.1. However it appears that this support was not extended to the <code>ast</code> module's <code>literal_eval()</code> function, as illustrated below.</p>
  <p>Was this intentional, an oversight, or something else — and what are the cleanest workarounds for creating a literal set from a string representation? (I assume the following works in Python 3.1+, right?)</p>
  <pre><code>import ast
  a_set = {1,2,3,4,5}
  print(a_set) 
  print(ast.literal_eval('{1,2,3,4,5}'))
  </code></pre>
  <p>Output showing error message:</p>
  <pre class="lang-none prettyprint-override"><code>set([1, 2, 3, 4, 5])
  Traceback (most recent call last):
    File &quot;...\setliterals.py&quot;, line 4, in &lt;module&gt;
      print ast.literal_eval('{1,2,3,4,5}')
    File &quot;...\Python\lib\ast.py&quot;, line 80, in literal_eval
      return _convert(node_or_string)
    File &quot;...\Python\lib\ast.py&quot;, line 79, in _convert
      raise ValueError('malformed string')
  ValueError: malformed string
  </code></pre>
  <p>P.S. The only workaround I can think of is to use <code>eval()</code>.</p>