Commit 2da19a69 authored by Stefan Behnel's avatar Stefan Behnel

fix test in older Py3.x versions, minor cleanups

parent b211d1e8
__doc__ = u""" """
>>> getg() >>> getg()
5 5
>>> f(42) >>> setg(42)
>>> getg() >>> getg()
42 42
>>> global_in_class
9
""" """
g = 5 g = 5
def f(a): def setg(a):
global g global g
g = a g = a
...@@ -21,5 +19,15 @@ def getg(): ...@@ -21,5 +19,15 @@ def getg():
class Test(object): class Test(object):
"""
>>> global_in_class
9
>>> Test.global_in_class
Traceback (most recent call last):
AttributeError: type object 'Test' has no attribute 'global_in_class'
>>> Test().global_in_class
Traceback (most recent call last):
AttributeError: 'Test' object has no attribute 'global_in_class'
"""
global global_in_class global global_in_class
global_in_class = 9 global_in_class = 9
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment