dunder-docs (was Python is DOOMED! Again!)

Marko Rauhamaa marko at pacujo.net
Tue Feb 3 06:27:52 EST 2015


Chris Angelico <rosuav at gmail.com>:

> On Tue, Feb 3, 2015 at 9:38 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> It's slightly sad that Python exposes the two-level attribute lookup.
>> It would be more elegant if, conceptually, all methods were retrieved
>> from the object's attribute dict. That way, the class would be simply
>> a mundane optimization trick instead of a metaphysical entity.
>
> That's the ECMAScript model of classes - prototype-based. It's not
> Python's. There are many different ways to do things.

For (almost) all practical purposes, that is the Python way as well. If
object instantiation (conceptually) copied the class's methods into the
object's dict, you'd get the semantics I'm looking for.


Marko



More information about the Python-list mailing list