__slots__ replacing __dict__ function

anabell at sh163.net anabell at sh163.net
Thu Nov 6 03:24:55 EST 2003


I have a code like this: 

       sqlString = 'INSERT INTO ' + self.TableName + ' VALUES (' + self.TableFields + ')'
       self.cursor.execute(sqlString, self.__dict__) 

This works correctly.  However, I'm applying __slots__ in my script.  And doing so would need the above statement modified.  How will __slots__ perform the same task defined above? 

Is there a container that holds the values of attributes contained in __slots__?  In __dict__, you have (attribute: value) pair. 






More information about the Python-list mailing list