z oświadczeniem praca na klasie
{class foo(object):
def __enter__ (self):
print("Enter")
def __exit__(self,type,value,traceback):
print("Exit")
def method(self):
print("Method")
with foo() as instant:
instant.method()}
Wykonaj ten plik py, a konsola wyświetli następujące komunikaty:
Enter
Exit
instant.method()
AttributeError: 'NoneType' object has no attribute 'method'
nie możesz znaleźć metod?