Would Anonymous Functions Help in Learning Programming/Python?
kay.schluehr at gmx.net
Sat Sep 22 15:58:57 CEST 2007
On Sep 22, 1:15 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Sat, 22 Sep 2007 02:44:35 -0700, Kay Schluehr wrote:
> > I checked out Io once and I disliked it. I expected Io's prototype OO
> > being just a more flexible variant of class based OO but Io couples a
> > prototype very closely to its offspring. When A produces B and A.f is
> > modified after production of B also B.f is modified. A controls the
> > state of B during the whole lifetime of B. I think parents shall not
> > do this, not in real life and also not in programming language
> > semantics.
> Well it's like Python: inherited slots (attributes) are looked up in the
> ancestors. It should be easy to override `Object clone` in Io, so all
> slots of the ancestor are shallow copied to the clone, but I guess this
> might break existing code. At least for your own code you could introduce
> a `realClone` slot.
> Marc 'BlackJack' Rintsch
But in class based OO most relevant attributes are defined during
object construction and they can't be simply changed by setting a
class attribute. Later you often create new attributes as but on
object level. You do not overuse the object/class relationship to
broadcast changes to all objects. While you might override 'Object
clone' I don't believe changing the way how the whole object model
works is a good idea and since it happens on source level you will get
also a performance hit.
More information about the Python-list