Mark Dickinson added the comment:

Isn't this just a consequence of Python's usual name-lookup rules?  In this 
code:

    def test():
        class Season(Enum):
            SPRING = Season()

the class definition in 'test' amounts to a local assignment to the name 
'Season'.  So the occurrence of 'Season' in the class definition is bound to 
that function local (at bytecode level, it's looked up using LOAD_DEREF instead 
of LOAD_NAME).

I find it difficult to see how one could 'fix' this without significant changes 
to the way that Python does name resolution.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17853>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to