In article <[EMAIL PROTECTED]>,
 "Carl Banks" <[EMAIL PROTECTED]> wrote:

> The principle behind this is pretty much "it was just a language design
> decision".

Yes, and I'm not taking issue with the decision, just pointing out that 
the desire to do things differently is not necessarily perverse.

> P.S. If you want to be truly evil, you could use a class hook to get
> the modifying in-place behavior:
> 
> def modify_in_place(name,bases,clsdict):
>     cls = globals()[name]
>     for attr,val in clsdict.iteritems():
>         setattr(cls,attr,val)
>     return cls
> 
> # Replace second C2 class above with this
> class C2:
>     __metaclass__ = modify_in_place
>     def m1(self): h()

Doesn't work for me:

>>> c2      
<__main__.C2 instance at 0x51e850>
>>> c2.m1()
G
>>> class C2:
...   __metaclass__ = modify_in_place
...   def m1(self): print 'Q'
... 
>>> c2.m1()
G
>>> C2().m1()
Q

rg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to