Skip to content

please implement OpenMath integer_interval as Python range #29

@MarcoCostantini

Description

@MarcoCostantini
>>> converter.to_python( decoder.decode_bytes( b"<OMA><OMS cdbase=\"http://www.openmath.org/cd\" cd=\"interval1\" name=\"integer_interval\"/><OMI>1</OMI><OMI>4</OMI></OMA>", snippet=True ) )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/openmath/convert.py", line 146, in to_python
    elem = self.to_python(omobj.elem)
  File "/usr/local/lib/python3.8/dist-packages/openmath/convert.py", line 143, in to_python
    return self._lookup_to_python(omobj.cdbase, omobj.cd, omobj.name)
  File "/usr/local/lib/python3.8/dist-packages/openmath/convert.py", line 133, in _lookup_to_python
    raise ValueError("no entry found")
ValueError: no entry found
>>> 

This should be converted to Python as range(1,5)
OpenMath integer_interval is already supported by the OpenMath implementations of Gap, Macaulay2, Ruby, Yacas, and range in the standard library of Python without importing anything

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions