[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Irit Katriel
Irit Katriel added the comment: Thanks, I think we can close this then. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Matěj Týč
Matěj Týč added the comment: Thanks for reaching out. I have no idea whether it helped me or not, sorry for not replying back in a timely manner :-( I think that the feature request/bugreport originates from bad coding practices, when I wanted argparse to perform something more than just

[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Irit Katriel
Irit Katriel added the comment: Matěj, did Paul's suggestion solve your use case? -- nosy: +iritkatriel status: open -> pending ___ Python tracker ___

[issue18467] argparse - problematic 'default' behavior

2013-07-19 Thread paul j3
paul j3 added the comment: Since parse_args takes an optional Namespace argument, you can set the its initial value to almost anything. For example, with the functions defined previously: parser = argparse.ArgumentParser() parser.add_argument('-a','--algorithm', choices=['Q','S'],

[issue18467] argparse - problematic 'default' behavior

2013-07-16 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18467 ___ ___ Python-bugs-list mailing list

[issue18467] argparse - problematic 'default' behavior

2013-07-16 Thread paul j3
paul j3 added the comment: I think this example illustrates your issue: class FooAction(argparse.Action): def __call__(self, parser, namespace, values, option_string = None): if values=='Q': setattr(namespace, self.dest,

[issue18467] argparse - problematic 'default' behavior

2013-07-15 Thread Matěj Týč
New submission from Matěj Týč: I have an issue with passing default values to arguments. Basically, I would like to have a 'choices' argument (indicating something using capital letters) and perform custom action (adding boolean values to the args namespace). See the bottom of this post for