paul j3 added the comment:
It should be easy to write a subclass of Action, or append Action, that does
what you want. It just needs a different `__call__` method. You just need a
way of identifying an default that needs to be overwritten as opposed to
appended to.
def __call__(self, parser, namespace, values, option_string=None):
current_value = getattr(namspace, self.dest)
if 'current_value is default':
setattr(namespace, self.dest, values)
return
else:
# the normal append action
items = _copy.copy(_ensure_value(namespace, self.dest, []))
items.append(values)
setattr(namespace, self.dest, items)
People on StackOverFlow might have other ideas.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com