On Mon, Oct 21, 2019 at 8:21 PM Yonatan Zunger <zun...@humu.com> wrote:
>
> Hey everyone,
>
> I came across a case which might be a use case for a syntax extension, but 
> I'm not sure. Wanted to get feedback from the group.

[...]

> @CronJob('job-name', params...).override('dev', more-params...)
> def myFunction(...)

Could you modify the signature of CronJob's __init__ method to accept
override parameters as a dict or list in a keyword argument? Then this
example would look something like this:

@CronJob('job-name', params..., dev=more-params...)
def myFunction(...)

Internally, you could even keep the .override() method and have
__init__ call that method to do the work. The signature of __init__
could then either include an explicit keyword argument (defaulting to
None) for each environment you need to account for, or if there are
too many, a **kwargs catch-all from which you extract what you need.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RMFG43ZU2GAYWRSAS45VRU4QOZUJI257/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to