Conversation
| return result | ||
|
|
||
| @property | ||
| def elements(self): |
There was a problem hiding this comment.
It feels like something in the code or the API is wrong here.
I get nervous about "properties" doing possibly unbounded calculations such as self.to_expressions().
If I understand correctly, the caller somehow knows this is a compound Expression/Element and assumes that therefore it has an .element attribute which is of type Expression?
It feels like what should be happening that the caller should be asking instead for a conversion, that is, should be calling to_expression().elements
I need to think about this more.
There was a problem hiding this comment.
It feels like something in the code or the API is wrong here.
Probably it is, but I tried to build over the existing API. At least, this is "localized" in this class.
I get nervous about "properties" doing possibly unbounded calculations such as
self.to_expressions().If I understand correctly, the caller somehow knows this is a compound Expression/Element and assumes that therefore it has an
.elementattribute which is of typeExpression?
The problem is that Part assumes that an Expression has a property elements. This just provides the property by creating an Expression. A different possibility would be to implement a different rule for working with RowBoxes. I thought this change was simpler, but maybe there is a better approach.
It feels like what should be happening that the caller should be asking instead for a conversion, that is, should be calling
to_expression().elementsI need to think about this more.
Sure.
|
The what is most appreciated. However the how may need some more thought or discussion. |
|
@mmatera what is the status of this PR? |
@TiagoCavalcante, by now, it is a reminder to something we need to fix. |
|
Deprecated |
Another small fix to something that I found working on MakeBoxes. When a
BoxExpressionis passed as the first element toPart, since it does not have in general an attribute_elements, the evaluation ends with an unhandled exception. In particular, this happens toRowBox. This PR fixes it by providing an implementation for that method.