Class PropertyFunctor
source code
rdMolDescriptors.PythonPropertyFunctor --+
|
PropertyFunctor
Creates a python based property function that can be added to the
global property list. To use, subclass this class and override the
__call__ method. Then create an instance and add it to the
registry. The __call__ method should return a numeric value.
Example:
class NumAtoms(Descriptors.PropertyFunctor):
def __init__(self):
Descriptors.PropertyFunctor.__init__(self, "NumAtoms", "1.0.0")
def __call__(self, mol):
return mol.GetNumAtoms()
numAtoms = NumAtoms()
rdMolDescriptors.Properties.RegisterProperty(numAtoms)