Код: Выделить всё
class foo(object):
def __init__(self, name):
self.__name = name
def get_name(self):
return self.__name
Код: Выделить всё
test = foo("test")
print test
Код: Выделить всё
test = foo("test")
print test.get_name()
Подробнее здесь: https://stackoverflow.com/questions/303 ... n-of-class