Prototype OO
sam
sam at mas.pl
Fri Mar 21 06:43:33 EDT 2008
Bruno Desthuilliers napisaĆ(a):
>> In dynamically typed language when you create object A that is
>> inherited from another object B, than object A knows that B is his
>> predecessor. So
>> when you reference A.prop, then prop is looked in A first, then in B,
>> then in predecessors of B, and so on.
>
> What you're describing here is the inheritance mechanism of Python. And
> could apply just as well to javascript prototype mechanism. A javascript
> object has a reference to it's prototype object - that you can
> customize, rebind etc -, a Python object has a reference to it's class
> object - that you can customise, rebind etc...
I can see that Python and Javascript inheritance model is almost the same. Both
languages are dynamically typed. And it seems that using "classes" in Python
makes some things more complicated then it is necessary (eg functions, methods
and lambdas are differen beeing in Python concept).
> Don't be fooled by the term "class" itself - it's meaning is totally
> different in a language like Python.
Probably I'm not alone. Many people who think dymanic types are Rhight Thing in
programming will also prefer prototype-based programming to class-based.
> suspect you don't have a serious knowledge of Python's object model.
Yes -- I'm new to Python.
More information about the Python-list
mailing list