[Python-ideas] Annotations (and static typing)
Alexander Belopolsky
alexander.belopolsky at gmail.com
Wed Aug 20 20:44:59 CEST 2014
On Wed, Aug 20, 2014 at 2:13 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 20 August 2014 18:37, Andrea Censi <censi at mit.edu> wrote:
> > What can one do with a decorator that cannot be done with annotations?
>
> Python 2 compatibility.
Out of the way mark-up. Compare
@types(int, float, returns=float)
def foo(x, y):
..
to
def foo(x:int, y:float) -> float:
..
The decorator variant is visually closer to plain unannotated Python.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140820/7003dce3/attachment.html>
More information about the Python-ideas
mailing list