A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-June/134828.html below:

[Python-Dev] [numpy wishlist] Interpreter support for temporary elision in third-party classes

[Python-Dev] [numpy wishlist] Interpreter support for temporary elision in third-party classesNathaniel Smith njs at pobox.com
Thu Jun 5 23:47:54 CEST 2014
On Thu, Jun 5, 2014 at 10:37 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 5 June 2014 21:51, Nathaniel Smith <njs at pobox.com> wrote:
>> Is there a better idea I'm missing?
>
> Just a thought, but the temporaries come from the stack manipulation
> done by the likes of the BINARY_ADD opcode. (After all the bytecode
> doesn't use temporaries, it's a stack machine). Maybe BINARY_ADD and
> friends could allow for an alternative fast calling convention for
> __add__implementations that uses the stack slots directly? This may be
> something that's only plausible from C code, though. Or may not be
> plausible at all. I haven't looked at ceval.c for many years...
>
> If this is an insane idea, please feel free to ignore me :-)

To make sure I understand correctly, you're suggesting something like
adding a new set of special method slots, __te_add__, __te_mul__,
etc., which BINARY_ADD and friends would check for and if found,
dispatch to without going through PyNumber_Add? And this way, a type
like numpy's array could have a special implementation for __te_add__
that works the same as __add__, except with the added wrinkle that it
knows that it will only be called by the interpreter and thus any
arguments with refcnt 1 must be temporaries?

-n

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4