Overview of the feature
The HOC parser should be modified to call __add__ when two objects are added,
__getitem__ when there's indexing, e.g., pylist[1], __eq__ when two objects
are compared, etc.
If the object is a Python object, this would automatically do the right thing, but we
make no assumptions about the type of the object. For something like Vector, this
could be used to allow HOC to use the same shorthand for adding vectors and getting
a new vector that Python does (e.g., a+b instead of a.c().add(b)).
We may or may not want to add a special case for error handling, so that no one is
confused when they write a+b for objects that don't support __add__ and get
a message about there being no such method.
Foreseeable Impact
Right now all of these are syntax errors, so no backwards compatability issues are expected.
This would make it much easier to use rxd from HOC: No more __add__ invocations; one could just write ca + buf. If this change is implemented, the rxd.rst file examples should be modified in the documentation.
This would also facilitate working with PythonObjects in general.
Overview of the feature
The HOC parser should be modified to call
__add__when two objects are added,__getitem__when there's indexing, e.g.,pylist[1],__eq__when two objectsare compared, etc.
If the object is a Python object, this would automatically do the right thing, but we
make no assumptions about the type of the object. For something like
Vector, thiscould be used to allow HOC to use the same shorthand for adding vectors and getting
a new vector that Python does (e.g.,
a+binstead ofa.c().add(b)).We may or may not want to add a special case for error handling, so that no one is
confused when they write
a+bfor objects that don't support__add__and geta message about there being no such method.
Foreseeable Impact
Right now all of these are syntax errors, so no backwards compatability issues are expected.
This would make it much easier to use rxd from HOC: No more
__add__invocations; one could just writeca + buf. If this change is implemented, therxd.rstfile examples should be modified in the documentation.This would also facilitate working with PythonObjects in general.