[issue38736] argparse: wrong type from get_default when type is set

2019-11-12 Thread paul j3
Change by paul j3 : -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue38736] argparse: wrong type from get_default when type is set

2019-11-08 Thread paul j3
paul j3 added the comment: Yes you can set the default to be any object, such as an evaluated string. If it isn't a string it won't be passed through 'type'. The purpose of the delayed evaluation that I described is to avoid unnecessary evaluations. The worse case would be a write

[issue38736] argparse: wrong type from get_default when type is set

2019-11-08 Thread Erik Ahlén
Erik Ahlén added the comment: So, not a bug since you can just do `default = Path('file.txt')`? -- ___ Python tracker ___ ___

[issue38736] argparse: wrong type from get_default when type is set

2019-11-07 Thread paul j3
paul j3 added the comment: get_default just returns the default attribute as it is stored in the Action. Defaults are stored as given. During parsing the Action's default is placed in the args namespace at the start. At the end, it checks if the value in the namespace is a string that

[issue38736] argparse: wrong type from get_default when type is set

2019-11-07 Thread Erik Ahlén
New submission from Erik Ahlén : The type of the object returned by get_default isn't converted to the specified type supplied to add_argument. I would expect the type to be the same. -- components: Library (Lib) files: test.py messages: 356194 nosy: Erik Ahlén priority: normal