operations on types

Dr. John Q. Hacker zondervanz at gmail.com
Tue Jun 16 20:24:03 EDT 2015


[Dr. Bigcock wrote:]
> The current syntax for adding functionality to a class using mix-in style
via inheritance list conflates two very different things.
>
> A different way would be to create (sensible) operations on types:
>
> NewType = OldObject + mixin  #object composition
>
> Thoughts?

That's an awesome idea.  It's like a final way to understand and operate
with metaclasses.

One would have to decide how to merge the two classes, but this could be as
straightforward as merging two dictionaries, presumably in the order given.

This might also decide the fate of the super() function.  True is-a
inheritance shouldn't need to call super, the language should enforce the
relationship, and ensure it gets done before other methods are called in
the same routine.

Neat, I don't think any language has such a meta-feature for working with
types.  I'm surprised no one had thought of it before.

Zipher
(Did you steal that name from me? ;^)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150616/b6eafe58/attachment.html>


More information about the Python-list mailing list