Closed tkw1536 closed 6 years ago
I am ok with the idea, but this is an API change, which would break compatibility (in py-scscp, for example).
The fix is easy, so no big deal, but wouldn't it make sense to expose DefaultConverter.to_python()
and DefaultConverter.to_openmath()
at the module level?
I thought about the same thing after making the PR. I will see about adding an appropriate commit.
On March 2, 2018 1:13:01 PM GMT+01:00, Luca De Feo notifications@github.com wrote:
I am ok with the idea, but this is an API change, which would break compatibility (in py-scscp, for example).
The fix is easy, so no big deal, but wouldn't it make sense to expose
DefaultConverter.to_python()
andDefaultConverter.to_openmath()
at the module level?
Oh, and the register_
functions too, I suppose. I know Nicolas was using them in his code.
Looking into this. Should the shorthands to_python -> DefaultConverter.to_python
be considered
as deprecated? If not, should the test file just use them?
Done in #15.
By the way a question: we use the name "Converter" for two distinct things:
I was going to merge this, but I don't know what the failed checks mean.
@tkw1536, can you have a look and merge?
I wanted to have a look at this pull request some time ago, but for some reason I must have forgotten. I will have a look again.
I have rebased this onto master and made a few more fixes:
register
function to the global convert.py
namespaceFrom my end there is now nothing else to prevent this from being merged.
Previously, the convert module stored registered conversion functions inside global state. This made for akward code and also made it difficult to register multiple conversion functions for the same symbol.
This PR fixes the issue by introducing a new Converter class which stores all previously global state. For convenience, an instance of this class called
DefaultConverter
is provided as well. Furthermore, this PR updates the tests and documentation accordingly.