[Python-Dev] buitlins instance have modifiable __class__?

Samuele Pedroni pedronis@bluewin.ch
Sat, 28 Sep 2002 02:15:11 +0200

From: Guido van Rossum <guido@python.org>
> It was a mistake.  In 2.3, it's disallowed.  In 2.2.2, it'll still be
> allowed, but you shouldn't do this -- all sorts of bizarre stuff can
> happen because you can do this.
> So if you're asking about this for Jython, please don't allow this in
> Jython!

honestly I was hoping that it was unintended, implementing this would make
already complicated things even more so. So we are happy campers.

Maybe others will be less so, I have seen a module referred on c.l.p using the
"feature" escaped from the lab to make builtins observable <wink>.

> > > >>> exec "print a" in d
> > > 3
> > >
> > > Ok, that is the non cooperative behavior I already know about. ]
> > >
> >
> > I recall this was already discussed here, what is the idea, to leave
> > it as it is or make this work?
> That's not going to change in CPython, because I believe it would slow
> down lookup for builtins and globals too much if we had to check for a
> custom __getitem__.  But if you can fix it for Jython, go ahead.  I
> don't mind if there are places where Jython is "purer" than CPython.

Very likely the other way is what we will get in Jython by doing nothing