<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#330033" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 4/26/2013 6:22 PM, Greg Ewing wrote:<br>
</div>
<blockquote cite="mid:517B286D.2020601@canterbury.ac.nz" type="cite">Guido
van Rossum wrote:
<br>
<blockquote type="cite" style="color: #000000;">If we had access
to the syntax used for the definition, this would be
<br>
simple: assignments define items, def statements define methods.
But
<br>
at run time we only see the final object resulting from the
<br>
definition,
<br>
</blockquote>
<br>
Another way we could tell the difference is if the def
<br>
statement used a different protocol for making bindings
<br>
than assignment.
<br>
<br>
Suppose a def statement used in a class body called
<br>
__defitem__, if it exists, instead of __setitem__. Then
<br>
the metaclass would be able to do different things for
<br>
defs and assignments.
</blockquote>
<br>
Well, some assignments could be for non-enumeration items, once you
start allowing EnumItem in the list. Some method of grouping
enumeration items, or grouping non-enumeration items would solve the
problem.<br>
<br>
class Color( Enum ):<br>
Enum.__enumerationItems__(<br>
red=1,<br>
green=2,<br>
blue=3,<br>
)<br>
# other methods and assignments <br>
</body>
</html>