Currently one can register a callback for converting to Python an OpenMath symbol, based on cd and name.
A more general mechanism would be to support registering callbacks based on:
cdbase, cd, and name
cdbase and cd
cdbase
nothing (defining a default callback)
Taking the cdbase into account is required anyway by the OpenMath standard.
The others are practical in situations where all symbols in a given context (cd, cdbase) are handled identically, typically by loading the eponymous global Python object / functions.
Practical use case: in the pickle-based serialization, Florian recommends using a plain OMS symbol to represent a global Python objects; something like:
Currently one can register a callback for converting to Python an OpenMath symbol, based on cd and name. A more general mechanism would be to support registering callbacks based on:
Taking the cdbase into account is required anyway by the OpenMath standard. The others are practical in situations where all symbols in a given context (cd, cdbase) are handled identically, typically by loading the eponymous global Python object / functions.
Practical use case: in the pickle-based serialization, Florian recommends using a plain OMS symbol to represent a global Python objects; something like:
In that case, having to register all symbols would be unpractical.