Gordon McMillan wrote: > > ... > Then: > > class A: > def __init__(self): > self.y = <something> > class B(A): > def __set_y__(self, value): > ... > def __init__(self): > A.__init__(self) > > means that the hook in B will be invoked when A.__init__ > runs. I wonder what "gotchas" lie in wait ;-). Python is full of these gotchas. (__setattr__ has the same problem, for example). It's amazing that anything ever works. :) For any lurkers: my tongue is firmly in my cheek! > [I also note that there are quite a few Python developers who > want their users to say "x = obj.getx()", but want Python to > create the accessor method "getx(self)" (if they haven't written > one) and outlaw "x = obj.x". I have no sympathy for them, but > they exist.] Java-heads. What do you think of Don B's idea. It simplifies things somewhat. -- Paul Prescod - Not encumbered by corporate consensus "Hardly anything more unwelcome can befall a scientific writer than having the foundations of his edifice shaken after the work is finished. I have been placed in this position by a letter from Mr. Bertrand Russell..." - Frege, Appendix of Basic Laws of Arithmetic (of Russell's Paradox)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4