Re: enhancing/wrapping an existing instance of a duck

2008-09-01 Thread Bruno Desthuilliers
Neville Dempsey a écrit : What do I need to add to HTMLDecorator? A simpler example: import cgi class ClassX(object): pass # ... with own __repr__ class ClassY(object): pass # ... with own __repr__ inst_x=ClassX() Why do you need to prefix your variables with 'inst_' ? inst_y=ClassY(

Re: enhancing/wrapping an existing instance of a duck

2008-09-01 Thread Bruno Desthuilliers
Neville Dempsey a écrit : Basically I have an existing (maybe a rather large and complicated (existing) instance) that I want to add new member to. I suppose you mean "attributes" ? Cheers N Hacks/attempts follow: from math import sqrt try2 duck_obj = [ i*i for i

Re: enhancing/wrapping an existing instance of a duck

2008-08-31 Thread Neville Dempsey
What do I need to add to HTMLDecorator? A simpler example: import cgi class ClassX(object): pass # ... with own __repr__ class ClassY(object): pass # ... with own __repr__ inst_x=ClassX() inst_y=ClassY() inst_z=[ i*i for i in range(25) ] inst_b=True class HTMLDecorator(object): def

enhancing/wrapping an existing instance of a duck

2008-08-31 Thread Neville Dempsey
Basically I have an existing (maybe a rather large and complicated (existing) instance) that I want to add new member to. Cheers N Hacks/attempts follow: from math import sqrt try2 duck_obj = [ i*i for i in range(25) ] # OR a large sparse matrix # I "want" to an a use