[Python-Dev] Object customization (was: Arbitrary attributes on funcs and methods)

Gordon McMillan gmcm@hypernet.com
Fri, 14 Apr 2000 16:18:56 -0400


Vladimir Marangozov wrote:

> Gordon McMillan wrote:

> > Can you please explain how "consistency" is violated?
> >  
> 
> Yes, I can.

> Strictly speaking, if I say:
> 
> >>> a.author = "Guido"
> 
> and if 'author' is not an attribute of 'a' after the instantiation
> of A (i.e. after a = A() completes), we should get a NameError.

Ah. I see. Quite simply, you're arguing from First Principles in 
an area where I have none. I used to, but I found that all 
systems built from First Principles (Eiffel, Booch's 
methodology...) yielded 3 headed monsters.

It can be entertaining (in the WWF sense). Just trick some 
poor sucker into saying "class method" in the C++ sense and 
then watch Jim Fulton deck him, the ref and half the front row.
 
Personally, I regard (dynamic instance.attribute) as a handy 
feature, not as a flaw in the object model. 


- Gordon