[Python-ideas] Delay evaluation of annotations
Alexander Belopolsky
alexander.belopolsky at gmail.com
Thu Sep 22 16:02:57 EDT 2016
On Thu, Sep 22, 2016 at 3:58 PM, David Mertz <mertz at gnosis.cx> wrote:
> It's more verbose, but you can also spell it now as:
>
> class A:
> def __add__(self, other: type(self)) -> type(self): ...
>
No, you can't:
>>> class A:
... def __add__(self, other: type(self)) -> type(self): ...
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in A
NameError: name 'self' is not defined
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160922/5a19d5b3/attachment.html>
More information about the Python-ideas
mailing list