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

Guido van Rossum guido at python.org
Thu Aug 14 03:42:38 CEST 2014


On Wed, Aug 13, 2014 at 5:53 PM, Haoyi Li <haoyi.sg at gmail.com> wrote:

> > Both solutions have merit, but the idea of some implementations of the
> type checker having covariance and some contravariance is fairly
> disturbing.
>
> Why can't we have both? That's the only way to properly type things, since
> immutable-get-style APIs are always going to be convariant, set-only style
> APIs (e.g. a function that takes 1 arg and returns None) are going to be
> contravariant and mutable get-set APIs (like most python collections)
> should really be invariant.
>

That makes sense. Can you put something in the mypy tracker about this? (Or
send a pull request. :-)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140813/19aba365/attachment-0001.html>


More information about the Python-ideas mailing list