<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 05/07/2013 08:47 AM, Eli Bendersky
wrote:<br>
</div>
<blockquote
cite="mid:CAF-Rda-_PW8TGxVEMo2RbvmecpuXP9mDBU5dZDyQtPR-spEYZQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">def Color =
Enum('red green blue')<br>
</blockquote>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">It's an interesting idea, but as NIck
suggested we should probably discuss it on the python-ideas
list. [...]<br>
<br>
</div>
<div class="gmail_extra">A special syntax raises more questions
though, because it has to be defined very precisely. Feel free
to come up with a complete proposal to python-ideas, defining
the interesting semantics.<br>
</div>
</div>
</blockquote>
<br>
We don't need a special syntax, we can already do this:<br>
<br>
@Enum('red green blue')<br>
def Color(): pass<br>
<br>
<br>
Here, Enum would take the one argument, and return a function
working as a function decorator. That decorator would ignore the
body of the function and return the Enum. It's awful, but then so
is the idea of creating special syntax just for the functional form
of Enum--if we're willing to go down that road, let's just add new
syntax for enums and be done with it.<br>
<br>
<br>
As for the non-pickleability of enums created with the functional
interface, why can't it use the same mechanism (whatever it is) as
the three-argument form of type? Types created that way are
dynamic, yet have a __module__ and are pickleable.<br>
<br>
<br>
<i>/arry</i><br>
</body>
</html>