openff-toolkit icon indicating copy to clipboard operation
openff-toolkit copied to clipboard

[Request] More explicit function signature in Molecule.is_isomorphic_with

Open lilyminium opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

It's quite easy to mis-remember which keyword arguments are taken by is_isomorphic_with because the actual definition is in Molecule.are_isomorphic.

Describe the solution you'd like A clear and concise description of what you want to happen.

Instead of (other, **kwargs) explicitly list (other, return_atom_map=False, aromatic_matching=True, formal_charge_matching=True, bond_order_matching=True, atom_stereochemistry_matching=True, bond_stereochemistry_matching=True, strip_pyrimidal_n_atom_stereo=True, toolkit_registry=GLOBAL_TOOLKIT_REGISTRY, **kwargs)

It would be even nicer to take out **kwargs so typos, etc. don't go unnoticed.

It's more typing and more work, but easier to read.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Keep status quo, make users read the docs.

Additional context Add any other context or screenshots about the feature request here.

Edit:

Also, return_atom_map has no effect because is_isomorphic_with only ever returns the first item in the tuple.

lilyminium avatar Jun 11 '21 19:06 lilyminium

It would be even nicer to take out **kwargs so typos, etc. don't go unnoticed.

+1 from me on moving from keyword arguments to named arguments

mattwthompson avatar Jun 11 '21 19:06 mattwthompson

Also, its docstring says:

        return_atom_map: bool, default=False, optional
            will return an optional dict containing the atomic mapping.

but the forwarding call uses a hard-coded:

            return_atom_map=False,

adalke avatar Jun 14 '21 19:06 adalke

Fully agree -- I'd love a PR that fixes this and adds a test to ensure that the return_atom_map kwarg works as intended.

j-wags avatar Jun 14 '21 21:06 j-wags