[Python-ideas] Do we need non-heap types any more? (Was: Implicit submodule imports)

Sturla Molden sturla.molden at gmail.com
Mon Sep 29 16:15:18 CEST 2014


<random832 at fastmail.us> wrote:

> What? It is very unlikely, especially in existing code where it won't
> work at all, for someone to attempt to reassign the __class__ of a non
> heap type object. We are not talking about something that gets run on
> every object.

And because of that it is better to have the pipeline flushed whenever it
happens, rather than, say, 50 % of the times it might happen. But I aggree
with Andrew that it is something we should try to measure.

Similarly, tagging functions 'hot' or 'cold' might also be a good idea. We
know there are functions that will execute a lot, and there are error
handlers that will only rarely be run.

Anyone that has used Fortran will also know that tagging a function 'pure'
is of great help to the compiler, particularly if arrays or pointers are
involved. This informs the compiler that the function has no side effects.
For example if we assert that a function like sin(x) is pure, it does not
have to assume that calling this function will change something elsewhere.
In Fortran it is a keyword, but we can use it in C as a GNU extension.

Sturla



More information about the Python-ideas mailing list