[Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 13 02:47:29 CEST 2005

I just tried to implement an autoloader using a technique
I'm sure I used in an earlier Python version, but it no
longer seems to be allowed.

I'm trying to change the __class__ of a newly-imported
module to a subclass of types.ModuleType, but I'm getting

   TypeError: __class__ assignment: only for heap types

Have the rules concerning assignent to __class__ been
made more restrictive recently?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list