[Python-ideas] PEP 484 change proposal: Allowing @overload outside stub files

Nick Coghlan ncoghlan at gmail.com
Sat Jan 23 21:18:18 EST 2016


On 24 January 2016 at 04:13, Jukka Lehtosalo <jlehtosalo at gmail.com> wrote:
> On Sat, Jan 23, 2016 at 6:17 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> If you were to instead go with a Python 2 compatible comment based
>> inline solution for now, you'd then get to design the future official
>> spelling for multi-dispatch annotations based on your experience with
>> both that and with the decorator+annotations approach used in stub
>> files.
>
> Your proposed comment based solution looks nicer in Python 2 code than
> @overload. I'd prefer optimizing any syntax we choose for Python 3 as that's
> where the future is. I'd rather not be forced to use comment-based
> signatures in Python 3 only code.

For the benefit of folks reading this thread, but not the linked
issue: Guido pointed out some cases with variable signatures (e.g.
annotating a range-style API)  & keyword args where the stacked
comments idea doesn't work, so I switched to being +0 on the
"@overload in .py files" interim solution.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list