[Python-Dev] RFC: PEP 509: Add a private version to dict (original) (raw)
Stefan Behnel stefan_ml at behnel.de
Thu Apr 14 16:34:28 EDT 2016
- Previous message (by thread): [Python-Dev] RFC: PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] RFC: PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Victor Stinner schrieb am 14.04.2016 um 21:56:
Which kind of usage do you see in Cython?
Mainly caching, I guess. We could avoid global/module name lookups in some cases, especially inside of loops.
Off-topic (PEP 510):
I really want to experiment automatic generation of Cython code from the Python using profiling to discover function parameters types. Then use the PEP 510 to attach the fast Cython code to a Python function, but fallback to bytecode if the types are different. See the example of builtin functions in the PEP: https://www.python.org/dev/peps/pep-0510/#using-builtin-function Before having something fully automated, we can use some manual steps, like annotate manually function types, compile manually the code, etc.
Sounds like Cython's "Fused Types" could help here:
http://docs.cython.org/src/userguide/fusedtypes.html
It's essentially a generic functions implementation and you get a dispatch either at compile time or runtime, depending on where (Python/Cython) and how you call a function.
Stefan
- Previous message (by thread): [Python-Dev] RFC: PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] RFC: PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]