[Python-Dev] What should changing/setting __getattr__ (and similars) after classdef time do ?
Samuele Pedroni
pedroni@inf.ethz.ch
Sat, 2 Jun 2001 20:58:55 +0200
Hi.
Is this a case that only the BDFL could know and pronounce on ...
or I'm missing somenthing ...
Thanks for any feedback, Samuele Pedroni.
----- Original Message -----
From: Samuele Pedroni <pedroni@inf.ethz.ch>
To: <python-dev@python.org>
Sent: Friday, June 01, 2001 2:49 PM
Subject: [Python-Dev] __xxxattr__ caching semantic
> Hi.
>
> What is the intendend semantic wrt to __xxxattr__ caching:
>
> class X:
> pass
>
> def cga(self,name):
> print name
>
> def iga(name):
> print name
>
> x=X()
> x.__dict__['__getattr__'] = iga # 1.
> x.__getattr__ = iga # 2.
> X.__dict__['__getattr__'] = cga # 3.
> X.__getattr__ = cga # 4.
> x.a
>
> for the manual
>
> http://www.python.org/doc/current/ref/customization.html
>
> with all the variants x.a should fail, they should have
> no effect. In practice 4. work.
>
> Is that an implementation manual mismatch, is this indented, is there
> code around using 4. ?
>
> I'm asking this because jython has differences/bugs in this respect?
>
> I imagine that 1.-4. should work for all other __magic__ methods
> (this should be fixed in jython for some methods),
> OTOH jython has such a restriction on __del__ too, and this one cannot
> be removed (is not simply a matter of caching/non caching).
>
> regards, Samuele Pedroni.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
>