[Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))
Phillip J. Eby
pje at telecommunity.com
Fri Oct 14 03:42:32 CEST 2005
At 01:32 PM 10/14/2005 +1300, Greg Ewing wrote:
>Phillip J. Eby wrote:
>
> > Actually, it's desirable to be *able* to do it for anything. But
> certainly
> > for otherwise-immutable objects it can lead to aliasing issues.
>
>Even for immutables, it could be useful to be able to
>add behaviour that doesn't mutate anything.
I meant that just changing its class is a mutation, and since immutables
can be shared or cached, that could lead to problems. So I do think it's a
reasonable implementation limit to disallow changing the __class__ of an
immutable.
More information about the Python-Dev
mailing list