[Python-Dev] What should changing/setting __getattr__ (and similars) after classdef time do ?

Tim Peters tim.one@home.com
Sat, 2 Jun 2001 19:56:34 -0400


[Samuele Pedroni]
> ...
> The point is that jython implements the letter of the manual, and even
> extend the caching opt to some others __magic__ methods.  I wanted to
> know the intended behaviour in order to fix that in jython.

You got that one right the first time:  this requires BDFL pronouncement!
As semantically significant optimizations (the only reason for caching
__getattr__, e.g.) creep into the code but the docs lag behind, it gets more
and more unclear what's mandatory behavior and what's
implementation-defined.

This came up a couple weeks ago again in the context of what, exactly, rich
comparisons are supposed to do in all cases.  After poking holes in
everything Guido wrote, he turned it around and told me to write up what I
think it should say (which I have yet to do, as it's time-consuming and it
appears some of the current CPython behavior is at least partly
accidental -- but unclear exactly which parts).  So don't be surprised if
the same trick gets played on you ...