docstringargs: Python module for setting up argparse
rosuav at gmail.com
Tue Apr 21 08:59:46 CEST 2015
On Tue, Apr 21, 2015 at 4:46 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> Ow, this is getting extremely complicated. And you still haven't
>> actually answered the fundamental problem, which is: When will you
>> need this? When will you actually want to put two different
>> annotations onto the same function's parameters?
> You've posted this cool annotation for docstringargs: why shouldn't I
> want to use it? And PEP 0484 is about annotations for type checking,
> also cool. Why shouldn't I want to use that too?
Except that docstringargs is mainly for top-level functions, and PEP
484 / MyPy is mainly for library functions - plus, docstringargs
basically implies that all the function parameters are strings, so the
annotations are going to be rather less useful.
>> The language isn't going to get any type checking.
> I thought it was one of the motivations for annotations. PEP 0484
> ... the proposal assumes the existence of a separate off-line type
> checker which users can run over their source code voluntarily.
> That sounds like Erlang's Dialyzer, which is pretty useful and
> successful. So it seems like a good idea to me.
Off-line. Not part of the language itself. PEP 484 is standardizing a
format for them, but actually using them is staying the domain of
third-party utilities like MyPy. Nothing at all changes in the
language (annotations already exist), and the stdlib just grows a
typing.py that provides enough run-time so that things don't give
errors, but nothing in a basic CPython installation will do those
checks. Hence it's up to you what you do with them; simply running a
program won't check type annotations in any way.
More information about the Python-list