We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The treatment of the OpenMath literals (integer, float, string, byte array) is currently hard-coded in the convert methods.
The current treatment is a good defualt, but it should be possible to customize it.
One option, considering issue #12, is to simply use methods for this that can be overridden by other classes.
The text was updated successfully, but these errors were encountered:
You mean, like this:
>>> from openmath import * >>> i = convert.to_openmath(1) >>> i OMInteger(integer=1, id=None) >>> convert.to_python(i) 1 >>> convert.register_to_python(openmath.OMInteger, lambda x: "Hello") >>> convert.to_python(i) 'Hello'
Sorry, something went wrong.
Ah, right, it's already possible to customize it. The code itself could use it, replacing the last 2 lines of:
def to_python(omobj): """ Convert OpenMath object to Python """ if omobj.__class__ in _conv_to_py: return _conv_to_py[omobj.__class__](omobj) elif isinstance(omobj, om.OMInteger): return omobj.integer
by a call to register_to_python at initialization time.
No branches or pull requests
The treatment of the OpenMath literals (integer, float, string, byte array) is currently hard-coded in the convert methods.
The current treatment is a good defualt, but it should be possible to customize it.
One option, considering issue #12, is to simply use methods for this that can be overridden by other classes.
The text was updated successfully, but these errors were encountered: