On Mar 21, 11:57 am, kj <no.em...@please.post> wrote: > > Just accessing attributes looks a bit dangerous to me, due to bugs > like typing > > i.typo = 'foo' > > when what you meant is > > i.type = 'foo' > > I tried fixing this by mucking with __setattr__, but I didn't hit > on a satisfactory solution (basically, I couldn't find a good, > self-maintaining, way to specify the attributes that were OK to > set from those that weren't). Is there anything built-in? >
If you *really* want static typing and validation for attributes in Python, you might check out enthought traits: http://code.enthought.com/projects/traits/ Regards, Pat -- http://mail.python.org/mailman/listinfo/python-list