> What's going on here? > > Python 2.1b1 (#15, Mar 16 2001, 04:31:43) > [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 > Type "copyright", "credits" or "license" for more information. > >>> x = 1 > >>> class Foo: > ... print x > ... > 1 > >>> class Foo: > ... print x > ... x = 1 > ... > 1 > >>> class Foo: > ... print x > ... x = 2 > ... print x > ... > 1 > 2 > >>> x > 1 > > Can we come up with a consistent story on class scopes for 2.1? They are consistent with all past versions of Python. Class scopes don't work like function scopes -- they use LOAD_NAME and STORE_NAME. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4