tvalentyn commented on code in PR #23668:
URL: https://github.com/apache/beam/pull/23668#discussion_r997520752
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -134,11 +134,16 @@ def error(self, message):
class _DictUnionAction(argparse.Action):
+ """
+ argparse Action take union of json loads values. If a key is specified in
more
+ than one of the values, the last value takes precedence.
+ """
def __call__(self, parser, namespace, values, option_string=None):
- if hasattr(namespace,
Review Comment:
Given dicts are mutable, I would prefer not to initialize a class member
with a value passed into a function, even though it will probably be fine in
this case. Consider the following instead:
```
if not hasattr(namespace,
self.dest) or getattr(namespace, self.dest) is None:
setattr(namespace, self.dest, {})
getattr(namespace, self.dest).update(values)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]