using __setattr__

Tim Hochberg tim.hochberg at ieee.org
Wed Aug 30 15:11:26 EDT 2000


Jeff Sandys <sandysj at asme.org> writes:

[SNIP problem that Mike Fletcher solves and Jeff's thanks and solution...]

 
> The only other mess I don't like about this is that the actual 
> code has 26 fields and self.data needs to be initialized with 
> 26 'slots' to not error out.  Is there a cleaner way (like 26*"") 
> to initialize the self.data list?

I think you want:

self.__dict__['data'] = [""]*26

-tim




More information about the Python-list mailing list