Is it appropriate to use a class as a simple container in order to access attributes using a series of dot operators? Is their a more Pythonic way of doing this? For instance, I have a "container" class which is never instantiated directly, but only through another class. Access to certain attributes would be something like:
main_class.a.b.x where row and v1 are instances of the container class which are instantianted by main_class. I know I can use dictionaries, but this syntax is a little clearer as long as the number of dot operators is not too lengthy. Some code would be something like: class container(object): def __init__(self): pass class main_class(object): def __init__(self): self.a = container() settatr(self.a, 'b', container()) settatr(self.a.b, 'x', 2) Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list