docstringargs: Python module for setting up argparse

Paul Rubin at nospam.invalid
Tue Apr 21 07:08:09 CEST 2015

Chris Angelico <rosuav at> writes:
> PEP 484 says that type hints don't need a decorator, but if it were
> anything else, then yes, it'd need a second decorator. But what if one
> of the annotation usages wants to be a dictionary? How can you elide
> the outer dictionary and still recognize what's going on?

If there's only one annotation it can take a dictionary without an outer
one.  If there's more than one annotation then they would have to be
labelled: I don't see what difference it makes if one of the annotation
values is a dictionary.

> that everything is right there in the function signature... but look
> how easy it is to introduce bugs: you're inconsistent about whether
> the first parameter is called "name" or "user".

Heh, nice catch, it's late here.  But, that would have been caught
immediately by the type checker examining the type annotation.

> This is exactly why annotations exist. Like decorators themselves,
> they reduce repetition and thus bugs.

Type annotations add a small amount of repetition but they do reduce
bugs.  That's the reason for having them.

More information about the Python-list mailing list