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

Guido van Rossum guido at python.org
Thu Aug 14 00:00:20 CEST 2014


On Wed, Aug 13, 2014 at 1:50 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> On 08/13/2014 01:19 PM, Guido van Rossum wrote:
>
>  On Wed, Aug 13, 2014 at 12:59 PM, Ethan Furman wrote:
>>
>>>
>>> -1 on deprecating alternative uses of annotations.
>>>
>>
>> Do you have a favorite alternative annotation use that you actually use
>> (or are likely to)?
>>
>
> My script argument parser [1] uses annotations to figure out how to parse
> the cli parameters and cast them to appropriate values (copied the idea
> from one of Michele Simionato's projects... plac [2], I believe).
>
> I could store the info in some other structure besides 'annotations', but
> it's there and it fits the bill conceptually.  Amusingly, it's a form of
> type info, but instead of saying what it has to already be, says what it
> will become.
>

I couldn't find any docs for scription (the tarball contains just the
source code, not even an example), although I did find some for plac. I
expect using type annotations to the source of scription.py might actually
make it easier to grok what it does. :-)

But really, I'm sure that in Python 3.5, scription and mypy can coexist. If
the mypy idea takes off you might eventually be convinced to use a
different convention. But you'd get plenty of warning.


> [1] https://pypi.python.org/pypi/scription  (due for an overhaul now I've
> used it for awhile ;)
> [2] https://pypi.python.org/pypi/plac/0.9.1
>

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


More information about the Python-ideas mailing list