VS Code recognises that cosmo.angular_cl is a function but seems unable to infer the signature or access the docstring. If the current method to inject the functions as methods start working with tooltips, I think we should amend the docstring to explicitly state that the method is injected into the Cosmology object and the original function can be found in some other place.
For developers, cases like https://github.com/LSSTDESC/CCL/blob/master/pyccl/cosmology.py#L517 are confusing, since ctrl+f for "get_camb_pk_lin" does not yield any results in cosmology.py, even though one would expect that from it being used as a method of Cosmology.
Internally I'd avoid this kind of dynamically created APIs to keep the code easy to read and maintain.
I like OOP but playing around with the new API I found that it doesn't play nice with editors. In the example
VS Code recognises that
cosmo.angular_cl
is a function but seems unable to infer the signature or access the docstring. If the current method to inject the functions as methods start working with tooltips, I think we should amend the docstring to explicitly state that the method is injected into theCosmology
object and the original function can be found in some other place.For developers, cases like https://github.com/LSSTDESC/CCL/blob/master/pyccl/cosmology.py#L517 are confusing, since ctrl+f for "get_camb_pk_lin" does not yield any results in
cosmology.py
, even though one would expect that from it being used as a method ofCosmology
. Internally I'd avoid this kind of dynamically created APIs to keep the code easy to read and maintain.