On Tue, Apr 21, 2015 at 6:58 PM, Cory Benfield <c...@lukasa.co.uk> wrote: > On 21 April 2015 at 01:45, Chris Angelico <ros...@gmail.com> wrote: >> 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. > > It can be a great help to whom? Not to me (the library author), > because I can't use them in my library code, because I have to support > 2.7. That's by no means a bad thing (after all, most libraries are > written to help others), but I found it really unclear who was being > advantaged here.
Mainly application users get the benefit, I expect. But I may be wrong. > ... That's got *nothing* on the type of the `files` > argument, which is the most incredibly polymorphic argument I've ever > seen: the best I can work out it would be: > > Optional[ > Union[ > Mapping[ > basestring, > Union[ > Tuple[basestring, Optional[Union[basestring, file]]], > Tuple[basestring, Optional[Union[basestring, file]], > Optional[basestring]], > Tuple[basestring, Optional[Union[basestring, file]], > Optional[basestring], Optional[Headers]] > ] > ], > Iterable[ > Tuple[ > basestring, > Union[ > Tuple[basestring, Optional[Union[basestring, file]]], > Tuple[basestring, Optional[Union[basestring, > file]], Optional[basestring]], > Tuple[basestring, Optional[Union[basestring, > file]], Optional[basestring], Optional[Headers]] > ] > ] > ] > ] At this point, you may want to just stop caring about the exact type. Part of the point of gradual typing is that you can short-cut a lot of this. And quite frankly, this isn't really helping anything. Just skip it and say that it's Union[Mapping, Iterable, None]. 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