
class Foo:
def func1():
print("function 1")
def func2(self):
print(id(self))
print("function 2")
>>> f.func1()
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
f.func1()
TypeError: func1() takes 0 positional arguments but 1 was given
TypeError : 파이썬 메서드의 첫 번째 인자로 항상 인스턴스가 전달>>> f = Foo()
>>> id(f) # id 라는 메모리를 확인하는 내장함수
43219856
즉, Foo()라는 class는 f라는 변수에 담았고,
이 f는 메모리에 할당되었는데,
이 메모리는 43219856 이라는 것이다.