Closed AustinT closed 8 months ago
If users know to use
unique_reactants
then they could just as easily writeset(reactants)
.This may be true, but I think another advantage of having
unique_reactants
is that it makes it more clear thereactants
are not unique. Otherwise I could imagine someone knowing they need unique reactants, but not realizingreactants
are not already unique... Apart from that LGTM.
Good point. I added them to the base class. Do you think that is the appropriate place to add them @kmaziarz? There is some redundancy between the implementation in MultiProductReaction
and SingleProductReaction
but it is very small.
I considered adding it just to SingleProductReaction
but that could create typing issues because general Reaction
objects will not necessarily have this method. I also considered making a shared base class between MultiProductReaction
and SingleProductReaction
(e.g. _BagReactantsReaction
) but I thought that would reduce readability.
I added them to the base class. Do you think that is the appropriate place to add them @kmaziarz? There is some redundancy between the implementation in
MultiProductReaction
andSingleProductReaction
but it is very small.
Yes, what you've done seems reasonable.
I added them to the base class. Do you think that is the appropriate place to add them @kmaziarz? There is some redundancy between the implementation in
MultiProductReaction
andSingleProductReaction
but it is very small.Yes, what you've done seems reasonable.
Sounds good, I'll merge this then.
This PR adds a new compromise Reaction class in a new file:
syntheseus/interface/reaction.py
. The class has the features we discussed in #58 [^1]. The class also includes a basic test.The new classes is not used anywhere at the moment[^2]. I will refactor the rest of the code to use it in another PR. I thought it would be test to propose the class in isolation first to avoid doing all the refactoring, then re-doing it if we decide to make additional changes.
[^1]: Except for the
unique_reactants
alias. After thinking about it a bit more, if users know to useunique_reactants
then they could just as easily writeset(reactants)
.[^2]: Except that I moved the
REACTION_SEPARATOR
constant toreaction.py
and changed resulting imports. It seemed odd to have it inmolecule.py