What's better about Ruby than Python?
Andrew Dalke
adalke at mindspring.com
Mon Aug 18 22:16:19 EDT 2003
Pedro Werneck:
> Well... I think you're overlooking the fact that you're not exactly
> _redefining_ the class. You're creating an entirely new class
> object and binding it to the same name, but the old class is still
> lying there,
I'm pretty sure he knows that and simply disagrees with that
design choice, suggesting that a class def should augment a
class if it already exists.
I wonder ... Alexander? What should this do?
from Q import X
class X:
def amethod(self): return 'ah, now THIS is better!'
Should it refine the X in the local namespace or make a new
class?
I have wondered if
def X.amethod(self): return "...."
should be allowed, but no longer think it should.
OTOH, a proper reload, which updated all instance's __class__
to the newly reloaded class, would be nice. I've stumbled
over that many a time.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list