可以在类中的任何位置分配属性吗?如果是这样,范围规则如何适用于以下每种情况?
class GreatComposers(object):
def __init__(self, name, birthday, instrument):
# attributes assigned in __init__
self.name = name
self.birthday = birthday
self.instrument = instrument
def setFullName(self)
# attributes assigned in other class methods
self.fullname = self.name + self.birthday
self.job = self.instrument + 'ist'
# attributes assigned outside any functions
self.nationality = 'german'