On Tue, Jun 20, 2017 at 5:02 PM, Randy Barlow <[email protected]> wrote: > On Tue, 2017-06-20 at 16:27 -0400, Randy Barlow wrote: >> Can mypy handle finding the types from docblocks, or is it strict >> about >> the format being like: >> >> # type: (int, bool) >> >> ? > > To elaborate on my question, I've been doing docblocks in this style: > > def add(x, y): > """ > Return the sum of x and y. > > Args: > x (int): The first number. > y (int): The second number. > Returns: > int: The sum of x and y. > """ > return x + y > > It'd be suuuuuper nice if mypy could do that… ☺ If not, I guess I could > include both annotatations, or perhaps only the mypy annotation so that > I'm not adding duplicate info.
To the best of my knowledge it does not support doing that and you would need to add PEP 484 conformant type annotations. -AdamM > _______________________________________________ > infrastructure mailing list -- [email protected] > To unsubscribe send an email to [email protected] > _______________________________________________ infrastructure mailing list -- [email protected] To unsubscribe send an email to [email protected]
