Message187934
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. |
|
Date |
User |
Action |
Args |
2013-04-27 21:01:26 | mark.dickinson | set | recipients:
+ mark.dickinson, daniel.urban, ethan.furman |
2013-04-27 21:01:26 | mark.dickinson | set | messageid: <1367096486.18.0.183635163843.issue17853@psf.upfronthosting.co.za> |
2013-04-27 21:01:26 | mark.dickinson | link | issue17853 messages |
2013-04-27 21:01:26 | mark.dickinson | create | |
|