[pypy-dev] Can someone explain __extend__?
VanL
van.lindberg at gmail.com
Fri Apr 17 18:58:36 CEST 2015
I am having some trouble wrapping my head around it. Reading through
rpython/tools/pairtype.py, it looks like it could be one or more of a
number of things:
- An implementation of javascript-style prototypes. (The similarity: you
don't subclass an object in js - you use the base object as a prototype and
extend it with new functionality)
- A way to do specialization and automatic dispatching on types so that a+b
works (both "a" and "b" know what they are, and whether they are compatible
with each other in an __add__/__radd__ sense, and what type should be
returned as a result of that call)
- Sort of a first draft of ABCs, allowing composition and type buildup
without explicit inheritance (roughly, __extend__ is similar to
ABC.register)
- Other?
Thanks,
Van
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150417/d5117836/attachment.html>
More information about the pypy-dev
mailing list