[Python-ideas] PEP 484 evolution
Rick Johnson
rantingrickjohnson at gmail.com
Sat Mar 19 21:34:07 EDT 2016
On Saturday, March 19, 2016 at 5:43:12 PM UTC-5, Terry Reedy wrote:
> Just to be sure you know, one of the options is to put
> type-hints in a separate stub file, so only those
> concerned will ever see them.
Yes, I was aware of the "stubfile option", and had stubfiles
been the *ONLY* option, i would have thrown my support
behind this type-hints thing 110%!
Just think of it...
Stub files would offload *ALL* the onerous on the *SINGLE*
programmer who wanted to employ them, and would not force
*ANY* reader to read them -- unless of course, the reader
*WANTED* to.
This would have been wonderful! It would have been great! It
would have been [Insert your happy word here]! But alas,
this is not what we have implemented.
> In particular, type hints for the stdlib will have to be
> kept separate.
That's a wonderful start. Now, if we can *ONLY* convince the
powers that be, to make it mandatory everywhere!
>
> def greeting(names: Union[List[str], Dict[int, List[str]]]) -> Union[
> List[str], Dict[int, List[str]]]:
>
> I agree that the extra overloading makes this hard to read
> by obscuring the essential parts. Anything like the above
> should be in private code or stub files.
Agreed. But unless the convention is forced, we will see
code like this everywhere.
Terry, you're closer to these folks than i am. You've *GOT*
to try and convince them that this "interleaved typehints"
thing is going to be a disaster -- see if you can gather some
"off the record" support.
If stubfiles were mandatory:
(1) Almost all of the work, that has been invested so far
by Python-dev, will *NOT* be for nothing.
(2) Typehints will *NOT* go away.
(3) We can save readability *AND* keep type-hints. (win-win)
If we can convince them to make stubfiles mandatory, then we
will prevent the propagation of "interleaved type-hint" code
in the wild. Then, we can redesign the type-hint-spec as a
magic comment -- instead of the current "interleaved dead
code" implementation. This is really the only way out of
this mess. We cannot dump type-hints, because too many folks
are counting on them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160319/fb72738a/attachment-0001.html>
More information about the Python-ideas
mailing list