[Python-ideas] constant/enum type in stdlib

Tim Delaney timothy.c.delaney at gmail.com
Mon Feb 11 21:22:03 CET 2013


On 12 February 2013 07:11, Tim Delaney <timothy.c.delaney at gmail.com> wrote:

> And I've just realised that my enums will be broken when assigning a
> literal containing a name lookup e.g.
>
> v = 1
>
> class MyEnum(Enum):
>     A, B
>     other_attr = (v,)
>
> other_attr will have an _EnumProxy instance. But I think I can do away
> with the _EnumProxy entirely now that I'm using sys._getframe(). Let me try
> something.
>

Too early in the morning. The above would avoid the whole _EnumProxy
because 'v' would be successfully looked up in the global namespace. But I
may still get rid of some instances of _EnumProxy.

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130212/3b85ca11/attachment.html>


More information about the Python-ideas mailing list