[Python-ideas] Proposal: Use mypy syntax for function annotations
Nick Coghlan
ncoghlan at gmail.com
Thu Aug 21 18:26:24 CEST 2014
On 22 August 2014 02:21, Chris Angelico <rosuav at gmail.com> wrote:
> 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.
For standalone functions, I agree. For methods and generics, I'd still
be somewhat wary of encouraging it.
Regards,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list