This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Bryan
Recipients Bryan, paul.j3, rhettinger, xtreak
Date 2020-06-23.17:06:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CABWq=i5YYpvrk_ZRcv0YtF-os-PHzTVn0eC08-OyoUaRvrm5jA@mail.gmail.com>
In-reply-to <1592929244.92.0.656168653058.issue41087@roundup.psfhosted.org>
Content
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 default would have to adhere to that type. It is just programming
common sense....

On Wed, 24 Jun 2020 02:20 paul j3, <report@bugs.python.org> wrote:

>
> paul j3 <ajipanca@gmail.com> 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 error such as
> this - if they are errors at all.
>
> 'type' does not 'declare' what the attribute will be.  It is a function
> that is applied to the input string, and converts that to something or
> other, or raises a TypeError.  It is used only if there is a string value
> to work on, either from the user, or a string default.
>
> This is not a bug, so should be closed.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue41087>
> _______________________________________
>
History
Date User Action Args
2020-06-23 17:06:00Bryansetrecipients: + Bryan, rhettinger, paul.j3, xtreak
2020-06-23 17:06:00Bryanlinkissue41087 messages
2020-06-23 17:06:00Bryancreate