Prothon, metaclasses, Zope [Was: A 'Python like' language]

Mark Hahn mark at prothon.org
Tue Mar 30 01:35:04 EST 2004


> 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).  You need to unthink
classes when designing in Prothon.  If you try to move a problem from Python
to Prothon and think in the same classes/subclasses metaphors you won't get
very far.

Mark Hahn (Prothon Author)

"Greg Ewing (using news.cis.dfn.de)" <ieyf4fu02 at sneakemail.com> wrote in
message news:c4aia1$2d44ll$1 at ID-169208.news.uni-berlin.de...
> Joe Mason wrote:
> > In article <95aa1afa.0403280258.41dc5cd9 at posting.google.com>, Michele
Simionato wrote:
> >
> >>Uh? The base class __init__ method is not called when I derive a new
> >>class. I want to make the make the check at class level, *before*
> >>instantiating.
> >
> > It is if you call the inherited __init__ method, which you should be
> > doing because it probably does important stuff.
>
> But presumably he wants the check done only once, when a subclass
> is defined, *not* every time said subclass is instantiated. In
> Prothon it appears that both of these end up invoking the same
> __init__ method, so there's no way of telling them apart.
>
> -- 
> 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