WolframResearch / WolframClientForPython

Call Wolfram Language functions from Python
https://wolfr.am/wolframclientdoc
MIT License
446 stars 47 forks source link

How to make a python class automatic conversion in Mathematica #15

Closed oovm closed 4 years ago

oovm commented 4 years ago

I know that class who inherits the WLSerializable class and overrides the to_wl method can be automatically converted in Mathematica.

But how to modify the existing python class?

For example, how to extend symbols in sympy.

DbxDev commented 4 years ago

You should take a look at this section of the documentation: https://reference.wolfram.com/language/WolframClientForPython/docpages/advanced_usages.html#extending-serialization-writing-an-encoder

It explain how one can define encoders for arbitrary classes. Please let me know if that answers your question.

oovm commented 4 years ago

Nice work, very easy to use!