You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment all attributes with a trailing underscore are considered results.
This works nice in a general case.
It becomes a little annoying when using dataclasses/attrs, as we need to exclude these fields explicitly, when we provided type information for them.
Further, to don't make the API even more confusing, we only allow the run method to write these attributes. The optimize methods have no way to write results (see #46, #45).
Overcomming both issues, we could allow to define nested typed classes to store results in.
With a little bit of magic (see below), we can enforce that each instance automatically gets a fresh instance of the class to write results in.
We could either enforce naiming of the these objects (e.g. r_, R_) for the actual results or we could use the decorator to mark and find them.
With that we could also allow to define specific additional optimization results. Either using a specific name or a seperate decorator.
Unfortunately, Pycharms autocomplete is not happy with the decorator and we don't get typechecking or autocomplete for the TypedResults case. VsCode works
The text was updated successfully, but these errors were encountered:
At the moment all attributes with a trailing underscore are considered results.
This works nice in a general case.
It becomes a little annoying when using dataclasses/attrs, as we need to exclude these fields explicitly, when we provided type information for them.
Further, to don't make the API even more confusing, we only allow the run method to write these attributes. The optimize methods have no way to write results (see #46, #45).
Overcomming both issues, we could allow to define nested typed classes to store results in.
With a little bit of magic (see below), we can enforce that each instance automatically gets a fresh instance of the class to write results in.
We could either enforce naiming of the these objects (e.g.
r_
,R_
) for the actual results or we could use the decorator to mark and find them.With that we could also allow to define specific additional optimization results. Either using a specific name or a seperate decorator.
Unfortunately, Pycharms autocomplete is not happy with the decorator and we don't get typechecking or autocomplete for the TypedResults case. VsCode works
The text was updated successfully, but these errors were encountered: