[Python-Dev] Class decorators

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 30 13:20:58 CEST 2006


Raymond Hettinger wrote:

> FWIW, I do not consider it an abuse to use a class to create a small 
> namespace. Essentially that is what it is for -- it matters not whether 
> the class has no methods.

Two problems with that:

* The word "class" in front of it is a misnomer if
   you've no intention of using it as a class.

* It's not a completely blank slate -- it comes with
   various baggage in the form of __xxx__ attributes
   (my registration function has to filter those out).
   Plus some unwanted behaviour such as being callable,
   and doing magic things with attribute access when
   the attribute is a descriptor.

--
Greg


More information about the Python-Dev mailing list