Martin Drautzburg a écrit : > This may be pretty obvious for most of you: > > When I have an object (an instance of a class "Foo") I can access > attributes via dot notation: > > aFoo.bar > > however when I have a dictionary > > aDict = {"bar":"something"} > > I have to write > > aDict["bar"] > > What if I want to create a datastructure that can be used in dot > notation without having to create a class, i.e. because those objects > have no behavior at all?
A class inheriting from dict and implementing __getattr__ and __setattr__ should do the trick... -- http://mail.python.org/mailman/listinfo/python-list