[issue41087] Argparse int / float default

2020-06-24 Thread Vedran Čačić
Vedran Čačić added the comment: Python _is_ strongly typed. As soon as you try to use that 0.005 as an index into a list or something else that requires an int, you'll get a TypeError. Strong typing is not the same as static typing. It is a common misconception. And common sense is always com

[issue41087] Argparse int / float default

2020-06-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pyth

[issue41087] Argparse int / float default

2020-06-23 Thread Bryan
Bryan added the comment: So you agree, Python lacks common sense... On Wed, 24 Jun 2020 at 03:32, Vedran Čačić wrote: > > Vedran Čačić added the comment: > > Yes, it is common sense in statically typed languages. Python is not > statically typed. Many other things are also "common sense" in

[issue41087] Argparse int / float default

2020-06-23 Thread Vedran Čačić
Vedran Čačić added the comment: Yes, it is common sense in statically typed languages. Python is not statically typed. Many other things are also "common sense" in various paradigms, which doesn't mean they should also be in Python. -- nosy: +veky

[issue41087] Argparse int / float default

2020-06-23 Thread Bryan
Bryan added the comment: This sort of ambiguity is why I like strongly typed languages and languages where timtoady is not seen often. I can guarantee you, that if argparse was implemented in Pascal (and copt most probably has been), that if type was specified and a default given, that the def

[issue41087] Argparse int / float default

2020-06-23 Thread paul j3
paul j3 added the comment: No, parameters like `type` let the developer control what his users provides. Violating that produces a runtime error, and exit. But in general argparse does not try to control values that the developer uses. There's plenty of time during development to catch err

[issue41087] Argparse int / float default

2020-06-23 Thread Bryan
Bryan added the comment: Maybe so, But, the issue is, if it trips up a user when they try to use the option, it should trip up the dev when the default is used... On Tue, 23 Jun 2020 18:47 Karthikeyan Singaravelan, wrote: > > Karthikeyan Singaravelan added the comment: > > There is a docum

[issue41087] Argparse int / float default

2020-06-23 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: There is a documentation note on type casting along with an example similar to the report https://docs.python.org/3.8/library/argparse.html#default > If the default value is a string, the parser parses the value as if it were a > command-line argum

[issue41087] Argparse int / float default

2020-06-23 Thread Bryan
New submission from Bryan : parser.add_argument('-e', '--Edge', type = int, default = 0.005, metavar = 'Edge') Runs fine. Script uses default of 0.005 even when int specified. But if user tries to change, not an int -- messages: 372143 nosy: Bryan priority: normal severity: norma