Почему не работает:
class X: var1 = 1 def __enter__(self): pass def __exit__(self, type, value, traceback): pass with X() as z: print z.var1
Я получаю:
print z.var1 AttributeError: 'NoneType' object has no attribute 'var1'