[Python-Dev] A bit faster access to module attributes

Guido van Rossum guido@python.org
Tue, 01 Jul 2003 07:10:28 -0400

> Python module calls PyObject_GenericGetAttr/PyObject_GenericSetAttr pair
> to do attribute lookup. (moduleobject.c,object.c)

This was introduced at the time when modules were made subclassable;
before then, it looked pretty much like what you propose.

> IMO it adds unnecessary overhead, and could be replaced with a bit
> simplified functions.

Have you found any situation where this particular operation was

I believe (without thinking it through in detail) that the generic
getattr/setattr routines are required in order to support subclassing
of modules, which people use.

So I think your suggestion cannot work, and I also think it is
unnecessary, so I don't believe it is worth the bother.

--Guido van Rossum (home page: http://www.python.org/~guido/)