-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Writing to MOL error #523
Comments
I love the idea of defining the reader/writer dict at the class level, rather than twice in the I'm not sure that I like the |
The try/except construct will save a key hashing and dict lookup, and most of the time the key will exist. Pythonistas usually prefer EAFP than LBYL. Not that it matters in practice if this is not a tight loop. |
Glad you like the idea I think it would definitely help keep the functions clean and make adding more in future very easy as you would only have to extend the dictionary. I would also vote for the |
Wow, I just read a little into LBYL and EAFP and this is a serious debate. Even Guido chimed in. I don't think a 2x speedup is of serious concern in this specific situation. Between now and the heat death of the universe, using LBYL throughout the OFFTK ecosystem may cumulatively require several additional cpu-seconds. On the other hand, using try/excepts liberally throughout OFFTK runs the risk of diverting developer attention from ToolkitWrapper try/excepts (which will become complex and nasty as we find more failure modes). Developer time is much more expensive than CPU seconds, and if misinterpreting a try/except causes an OFF developer to take 15 more minutes to debug a problem, that's a net loss for the universe. Anyway, that's just my two cents. I see the points of view on the other side, and would be happy to take a vote among OFF devs and agree to use one convention or another throughout the ecosystem. |
Yeah, this is quite a big thing in python letting the flow beeing controlled with exceptions since they are designed to be cheap. My personal preference is to use exceptions but like you say this can be an issue for bugs if not used precisely, happy to do what the general consensus is, however. For now, shall I close this with my PR for XYZ file support, ill only change the writers for now as the readers are a little more complicated due to the extra functions called. |
Describe the bug
When trying to write molecules to
MOL
files with RDKit I get an error despite this being one of the supported file formats listed by the wrapper.To Reproduce
Steps to reproduce the behavior. A minimal reproducing set of python commands is ideal.
I think the writer dictionaries here and here just need to be updated. It may also be better to store the reference to these objects in one variable to save repetition of code and make updating writers easier for example
the function to write the files could then be something like
the readers could also be stored this way
Not sure how useful this second option is however as depending on the input different actions are performed this would only be simpler if the functions could be unified in some way.
Computing environment (please complete the following information):
The text was updated successfully, but these errors were encountered: