def foo(*args, **kwargs):
print 'args = ', args
print 'kwargs = ', kwargs
print '---------------------------------------'
같은 함수를 정의 할 python2.7를 사용하고
와 foo를 호출하여 (3), 출력은 실패 :
args = (3,)
kwargs = {}
원하는 것입니다.
하지만 파라미터 푸 같은 형태되어있는 클래스__init__
함수로서, I는 출력
x = Person(3)
TypeError: Person() takes no arguments (1 given)
이다
Person(3)
def Person():
def __init__(self, *args, **kwargs):
print args
print kwargs
x = Person(3)
를 호출하는 클래스 사람 instantize 없다
그게 많이 혼란스러워, 내가 놓친 게 있니?
[개체 지향 파이썬에서 변수 및 함수 액세스 - python] (http://stackoverflow.com/questions/18610378/accessing-variable-and-functions-in-object-oriented-python-python) –