str/repr/description fixes#975
Conversation
|
I don't fully get the problem...
or is it about a much harder question: how to 'nest' human descriptions of nested expressions? This one... I'm not sure what the use case is, and whether we should do it at all... Perhaps overwriting str/repr is not the right way to show descriptions, and we should have made a Finally, I don't even know the real Python-intended difference between 'str' and 'repr' and whether/how we can follow the intended difference? |
|
So what I meant with typing issue is the difference between having an NDVarArray as an argument and a list as an argument changes how the expression is printed (the "," vs ", " thingy). I'm pretty sure that So, For handling nested descriptios, I think the approach I impemented in this PR is fine? Just print the description if you are making a human-readible string representation no matter if the expr is a subexpression or not; otherwise use your |
So I encountered some typing issues from an unexpected angle: printing of constraints...
This PR does two things:
__repr__call of the parent. This may cause some issues when we have two subexpressions with the same description...I'm undecided on how to tackle the Element case, I currently use
to_listwhen the array is a numpy array, but that is overkill of course...Alternatively, we just add
__str__and__repr__overload for Element