The method '__repr__()' of MultiIndexSet should provide an unambiguous string representation of the instance
Following Python best-practice, the string information provided by __repr__()
can, at least in principle, be used to recreate the instance.
It is targeted towards developers to get as much useful information about the object.
The string provided by __str__()
on the other hand is targeted towards users; it provides user-friendly information.
Currently, only __repr__()
is implemented for the MultiIndexSet
class while the implementation of __str__()
use that of __repr__()
.
In other words, they produce the same string.
>>> import minterpy as mp
>>> mi # interpreter calls __repr__()
MultiIndexSet
[[0 0 0]
[1 0 0]
[2 0 0]
[0 1 0]
[1 1 0]
[0 2 0]
[0 0 1]
[1 0 1]
[0 1 1]
[0 0 2]]
>>> print(mi) # print() calls __str__()
MultiIndexSet
[[0 0 0]
[1 0 0]
[2 0 0]
[0 1 0]
[1 1 0]
[0 2 0]
[0 0 1]
[1 0 1]
[0 1 1]
[0 0 2]]
I propose to modify the __repr__()
of MultiIndexSet
to include at least the information regarding lp_degree
as the construction of an instance of MultiIndexSet
class requires at least the set of exponents and the lp-degree.
The implementation of __str__()
may also be modified to include the information regarding spatial dimension, poly. degree, and lp-degree.
This issue is created as part of the refactoring of the MultiIndexSet
class (Issue #99 (closed)).