[Python-ideas] Proposal: Use mypy syntax for function annotations

Chris Angelico rosuav at gmail.com
Thu Aug 21 18:21:17 CEST 2014


On Fri, Aug 22, 2014 at 2:15 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> I'm also -1, on the grounds that concrete types and ABCs are
> different, and I think type hinting should be heavily biased towards
> ABCs.

We keep seeing this line of argument coming up, and while I've only
been skimming, I haven't seen anyone comment that this applies to
parameters but not so much to return values. A function might take a
Sequence and iterate over it, and then return a concrete integer. Or
it might take a file-like object and a string, and yield a series of
strings. Or it might take some set of parameters, and return None
unconditionally. There's nothing wrong with being concrete about
return values.

ChrisA


More information about the Python-ideas mailing list