#NEWLINE# def __setattr__( self , name , part ) : #NEWLINE# #INDENT# if ( not hasattr ( self . __class__ , name ) ) : #NEWLINE# #INDENT# self . _validate_name ( name ) #NEWLINE# if ( not hasattr ( self , name ) ) : #NEWLINE# #INDENT# self . _parts . append ( part ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# old_part = getattr ( self , name ) #NEWLINE# self . _parts [ self . _parts . index ( old_part ) ] = part #NEWLINE# #UNINDENT# super ( Parts , self ) . __setattr__ ( old_part , part ) #NEWLINE# if hasattr ( part , 'set_world' ) : #NEWLINE# #INDENT# part . set_world ( self . _world ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if name . startswith ( '_' ) : #NEWLINE# #INDENT# super ( Parts , self ) . __setattr__ ( name , part ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise AttributeError ( ( '%s attribute is read only' % name ) )