[Python-ideas] Proposal to extend PEP 484 (gradual typing) to support Python 2.7

Guido van Rossum guido at python.org
Mon Jan 11 23:38:59 EST 2016


On Mon, Jan 11, 2016 at 5:39 PM, Steven D'Aprano <steve at pearwood.info>
wrote:

> On Mon, Jan 11, 2016 at 12:22:55PM -0800, Andrew Barnert via Python-ideas
> wrote:
>
> > in a few months we're going to see
> > Dropbox and Google and everyone else demanding a way to use type
> > hinting without wasting memory on annotations are runtime in 3.x.
>
> I would be happy to see a runtime switch similar to -O that drops
> annotations in 3.x, similar to how -OO drops docstrings.


Actually my experience with -OO (and even -O) suggest that that's not a
great model (e.g. it can't work with libraries like PLY that inspect
docstrings). A better model might be to let people select this on a per
module basis. Though I could also see a future where __annotations__ is a
more space-efficient data structure than dict.

Have you already run into a situation where __annotations__ takes up too
much space?

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


More information about the Python-ideas mailing list