bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Mar 20 12:33:45 CET 2008
sam a écrit :
> Some time ago (2004) there were talks about prototype-based languages
> and Prothon emerged.
> Can someone tell me why class-based OO is better that Prototype based,
For which definition of "better" ?-)
> especially in scripting langage with dynamic types as Python is?
> Here are some links:
Most of the arguments in favor of prototypes seems to come to, mainly:
1/ it lets you customize behaviour on a per-object base
2/ it removes the mental overhead of inheritance, classes etc
Point 1. is a non-problem in Python, since you can already add/replace
methods on a per-objec basis (ok, with a couple restrictions wrt/
__magic__ methods and such).
Point 2. is not (IMHO) such a problem in Python, where inheritance is
mainly an implementation detail (it's not needed for polymorphic
dispatch to work) and class hierarchy tend to be very flat, when they
here. That is, you get more or less the same flexibility. And a couple
attribute lookup mechanism), too.
More information about the Python-list