This is a proposal for an extension to the config syntax that allows objects to be imported directly from external (sub)modules using the ! tag and providing neither a list of args or a dict of kwargs. (N.B. to call a function without any arguments pass and empty list of args or an empty dict of kwargs). For example this enables:
cosmo1: !astropy.cosmology.Planck18 # import the Planck18 object and bind to cosmo1
cosmo2: !astropy.cosmology.default_cosmology.get [] # call default_cosmology.get() and bind to cosmo2
Note that as a result of the design, it is no longer possible to call a function with a single argument using a scalar node; the argument must be put into a list:
old_syntax: !len 'hello world!' # invalid
new_syntax: !len ['hello world!'] # correctly define an explicit list of args
Description
This is a proposal for an extension to the config syntax that allows objects to be imported directly from external (sub)modules using the
!
tag and providing neither a list of args or a dict of kwargs. (N.B. to call a function without any arguments pass and empty list of args or an empty dict of kwargs). For example this enables:Note that as a result of the design, it is no longer possible to call a function with a single argument using a scalar node; the argument must be put into a list:
Checklist