[Python-ideas] Allow Enum members to refer to each other during execution of body
Antony Lee
anntzer.lee at gmail.com
Thu Jul 11 23:07:33 CEST 2013
In the current version, they work with a custom __init__ (though of course,
as long as the actual arguments that need to be passed to __init__ are
provided, the pre-declared members are just "empty"). They do not work
with a custom __new__ (not sure how I could make this work, given that at
declaration time an "empty" member needs to be created but we don't know
what arguments we need to pass to __new__...).
As a side effect, however, the whole patch adds a new requirement: custom
__new__s must be defined before the members themselves; otherwise they
won't be called, for the same reason as above: if I don't know what __new__
is, I can't call it...
Antony
On Wednesday, July 10, 2013 6:52:24 PM UTC-7, stoneleaf wrote:
>
> On 07/10/2013 03:47 PM, Antony Lee wrote:
> >
> > Forward references are now implemented (https://github.com/anntzer/enum).
> They require an explicit declaration, à la
>
> Do they work with a custom __new__ ? __init__ ?
>
> --
> ~Ethan~
> _______________________________________________
> Python-ideas mailing list
> Python... at python.org <javascript:>
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130711/b607985b/attachment.html>
More information about the Python-ideas
mailing list