addPyToM2Function(type, f, desc)
Most of the hooks used by value have the same general format: if the python object has a particular type, then use a particular function to convert it to a corresponding Macaulay2 thing. This function simplifies the process of adding such a hook.
For example, suppose we would like to convert Fraction objects from the Python fractions module to QQ objects. Without adding a hook, value will do nothing with these objects.
|
|
|
So we write a function to do the conversion and then install the hook using addPyToM2Function.
|
|
|
|
The object addPyToM2Function is a method function.
The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Python/doc.m2:463:0.