[Python-ideas] Proposal: Use mypy syntax for function annotations

Georg Brandl g.brandl at gmx.net
Sat Aug 23 11:21:58 CEST 2014


On 08/21/2014 03:23 PM, Antoine Pitrou wrote:

>> One last thing: let’s not add |List|, |TList|, etc. Just use |list| and
>> other existing types to generate new types.
> 
> I'm -1 on that, for exactly the same reason as above.

Another reason is that it makes it even easier for people to use the
usually too narrow and therefore annoying

   list[int]

instead of the correct

   Iterable[int] or Sequence[int]


Another thought is whether, assuming

   class MyList(list):
       ...

the type  "MyList[int]"  would do the expected thing.  (And if not,
how you would write the correct type generation code.)


Georg



More information about the Python-ideas mailing list