__getattr__ and __setattr__ troubles

François Pinard pinard at iro.umontreal.ca
Wed Jun 7 11:50:37 EDT 2000


Michael Hudson <mwh21 at cam.ac.uk> writes:

> [...] Then the code in ceval.c calls [...]
> Does that help?

It might help understanding the internals if I ever dive in them, yes.
So I'm saving your letter for later study.  And might reply in a few
years, maybe!  Not so long ago, I replied to a letter Guido sent maybe
ten years ago, and sleeping here since.  The conversation merely resumed! :-)

> > > Overriding __getattr__ is good for "oo, ain't that cool" value,
> > > but it is probably best to try to avoid it - if you need it, fine,
> > > but consider alternatives first.

> > [...] implementing __getattr__ is part of an intermediary cleanup, before
> > attempting to move further, so to simplify code all over and gain better
> > maintainability.  [...]

> Fair enough.

And since then, yet another cleanup got rid of __getattr__. :-)

> > P.S. - I hope that Guido will do his best so future Python stays legible.

> Out of curiosity, here do you mean Python source, or the C source of
> Python?  Both are almost uniquely readable, but which did you mean?

Python, the language.  If Python get modified so people may start randomly
casing a single identifier, for example, Python will become less legible.
If Python stops requiring the `:' within compound constructs to announce an
increase in indentation, Python might become less legible.  And such things.

Of course, I'm a proponent of legibility, everywhere.  My C code is
considered legible by those having worked with it, and I hope Guido tries
to write legible C as well.  I did try my best to be legible in Perl like
for everything else, but failed to satisfy myself for big Perl projects.

P.S. - Despite my poor knowledge of English, I also try to be legible while
writing messages.  You might be amused to know that I'm anal enough to
rewrite sentences parts and change words many times, until the paragraphs
fill more nicely.  You might observe that many of my paragraphs roughly
look like rectangles.  Two spaces after a sentence end, in a message,
increase legibility.  So is ragged right with fixed width fonts, rather
the simultaneous left-right justification.  I care a lot about legibility.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list