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
I found this a bit surprising: you can have an empty query that "matches" anything, producing an empty match, but at the same time it's considered non-matching:
In [31]: mol = Chem.MolFromSmiles('CCO')
In [32]: q = Chem.MolFromSmarts('')
In [33]: mol.HasSubstructMatch(q)
Out[33]: False
In [34]: mol.GetSubstructMatches(q)
Out[34]: ((),)
In [35]: bool(mol.GetSubstructMatches(q))
Out[35]: True
What the right behavior should be is a bit of a philosophical question, but I would argue that if GetSubstructMatches returns a truthy value, HasSubstructMatch should do so as well.
My preference would be for GetSubstructMatches should return () instead of ((),), however, so they would both be false in a Boolean context.
Configuration (please complete the following information):
RDKit version: 2021.03.1
OS: CentOS 7
If you are not using conda: how did you install the RDKit? Schrödinger
The text was updated successfully, but these errors were encountered:
I found this a bit surprising: you can have an empty query that "matches" anything, producing an empty match, but at the same time it's considered non-matching:
What the right behavior should be is a bit of a philosophical question, but I would argue that if GetSubstructMatches returns a truthy value, HasSubstructMatch should do so as well.
My preference would be for GetSubstructMatches should return () instead of ((),), however, so they would both be false in a Boolean context.
Configuration (please complete the following information):
The text was updated successfully, but these errors were encountered: