Andre Meyer: > Is the test meaningful and are you surprised by the results? > I am, actually, because I would have assumed that attribute access > with an object should be faster because lookup can be precompiled.
The results seem okay. Python is a dynamic language, object attributes (and methods, etc) are kept inside a dict, where you can add and remove them when you like. So using a dict is faster. You can also take a look at __slots__ Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list