On Tue, Apr 21, 2015 at 10:52 AM, Ben Finney <ben+pyt...@benfinney.id.au> wrote:
> Chris Angelico <ros...@gmail.com> writes:
>
>> On Tue, Apr 21, 2015 at 9:41 AM, Jack Diederich <jackd...@gmail.com> wrote:
>> > * It is not optional. Please stop saying that. The people promoting
>> > it would prefer that everyone use it. If it is approved it will be
>> > optional in the way that PEP8 is optional. If I'm reading your
>> > annotated code it is certainly /not/ optional that I understand the
>> > annotations.
> […]
>>
>> Maybe I'm completely misreading everything here […]
>
> I think you've misunderstood the complaint.
>
>> When you're writing a library, it can be a great help to provide type
>> annotations, because every application that uses your library can
>> benefit. When you're writing an application, you can completely ignore
>> them, but still get the benefit of everyone else's.
>
> Jack is not complaining only about *writing* code. He's complaining
> about the effect this will have on code that we all are expected to
> *read*.

Ahh. Yes, that's a concern. When you go digging into that library to
find out how it works, yes, you'd be face-to-face with their type
annotations.

I doubt the worst-case complex ones are going to come up all that
often, though. Sure, you might declare that something returns a list
of dictionaries mapping tuples of integers and strings to list of sets
of atoms, but that's hardly common. (And chances are you can just
declare that it returns List[Dict] and have done with it.)

Maybe it'd be of value to have a quick "code stripper" that takes away
all the annotations, plus any other junk/framing that you're not
interested in, and gives you something you can browse in a text
editor? It could take away all the Sphinx adornments from docstrings,
any source control versioning markers, all that kind of thing. Then
you could read through the code in a simpler form, while still having
type annotations there for you if you need them.

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to