Re: [Python-Dev] Any grammar experts?

2015年1月26日 15:34:16 -0800

On 2015年1月27日 00:07:08 +0100, Antoine Pitrou <[email protected]> wrote:
> On 2015年1月26日 16:28:24 -0500
> "R. David Murray" <[email protected]> wrote:
> > 
> > My use case is a configuration method that takes keyword parameters.
> > In tests I want to specify a bunch of default values for the
> > configuration, but I want individual test methods to be able
> > to override those values. So I have a bunch of code that does
> > the equivalent of:
> > 
> > from test.support import default_config
> > [...]
> > def _prep(self, config_overrides):
> > config = default.config.copy()
> > config.update(config_overrides)
> > my_config_object.load(**config)
> > ....
> > 
> > With the current proposal I could instead do:
> > 
> > def _prep(self, config_overrides):
> > my_config_object.load(**default_config, **config_overrides)
> 
> It sounds like the _prep() method exists once in your code base, this
> isn't an idiom you are duplicating everywhere. The incentive for a
> syntactic shortcut looks pretty thin.
Something similar exists between five and ten times (I didn't go in and
count) in my current code base, in various specific forms for different
test classes.
--David
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to