[Python-ideas] Enums
Paul Moore
p.f.moore at gmail.com
Thu Jul 28 16:58:10 CEST 2011
On 28 July 2011 14:52, MRAB <python at mrabarnett.plus.com> wrote:
> On 28/07/2011 04:57, Nick Coghlan wrote:
>> Most proposed solutions relied on some form of abuse of the def
>> statement to define arbitrary objects that knew their own name. For
>> example:
>>
>> def red from namedvalue(1) # Rather unnatural phrasing
>> def red as namedvalue(1) # Phrasing is natural, but the name is on
>> the wrong side of the 'as'
>> def red = namedvalue(1) # Simple assignment may not suggest enough
>> magic
>> def as red = namedvalue(1) # Syntax soup!
>> as red def namedvalue(1) # Just throw keywords at the screen and
>> see if anything sticks
>> red def= namedvalue(1) # An alternative inspired by augmented
>> assignment
>> def red<< namedvalue(1) # Arbitrary but suggestive
>>
> [snip]
> You missed out:
>
> def red is namedvalue(1)
IIRC, there was also
red := namedvalue(1)
which is probably disallowed because it looks like grit on Tim's
screen, but actually has some relevant history in that := is used as
an assignment operator in many languages.
Paul
More information about the Python-ideas
mailing list