Prothon, metaclasses, Zope [Was: A 'Python like' language]
Greg Ewing (using news.cis.dfn.de)
ieyf4fu02 at sneakemail.com
Wed Mar 31 00:21:04 EST 2004
Mark Hahn wrote:
> > But presumably he wants the check done only once, when a subclass is
> > defined, *not* every time said subclass is instantiated.
>
> You can have a different __init__ for an object and it's prototpe.So the
> Prothon equivalent of a subclass can easily have different __init__
> behaviour than it's child (what you call instance).
Can you post some code illustrating how you would do this
in Prothon? I still can't see how, at the point where you
do
X = Base()
anything can tell whether you're intending to use X as
an instance of Base or whether you're going to go on to
say
with X:
def ...
and use X as a prototype which inherits behaviour from
Base. In both cases, Base.__init__ is going to get invoked
before you have a chance to define any other __init__ that
might override it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list