[Python-bugs-list] [ python-Bugs-407800 ] global in classdef affect nested scope!?
nobody
nobody@sourceforge.net
Sun, 11 Mar 2001 19:00:59 -0800
Bugs #407800, was updated on 2001-03-11 18:18
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407800&group_id=5470
Category: Parser/Compiler
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous
Assigned to: Jeremy Hylton
Summary: global in classdef affect nested scope!?
Initial Comment:
[pedroni]
> (II)
> from __future__ import nested_scopes
> x='top'
> def ta():
> x='ta'
> class A:
> global x
> def tata(self):
> return x # LOAD_GLOBAL
> return A
>
> print ta()().tata() # -> 'top'
>
> should not the global decl in class scope be ignored
and so x be
> bound to x in ta, resulting in 'ta' as output?
[Tim Peters]
Yes, this one is clearly a bug. Good catch!
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407800&group_id=5470