schrodinger.utils.typing module¶
File that defines custom typing classes for use in the schrodinger package.
A note on abstract base classes¶
Some types in here are defined as a subclass of abc.ABC
. Such classes will be
a virtual base class of any type that implements the abstract methods defined.
Thus the Appendable
class is a virtual base class for the builtin list
type because list
implements an append
method:
from schrodinger.utils.typing import Appendable
assert isinstance([], Appendable)
assert issubclass(list, Appendable)
assert not issubclass(tuple, Appendable)
For more information, read https://docs.python.org/3/library/abc.html and https://peps.python.org/pep-3119/