屬性可以在類中的任何位置分配嗎?如果是這樣,範圍規則如何適用於以下每種情況?屬性可以在類中的任何位置分配嗎?
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'