Yes, of course 'self' is only a scoped name within the body of the method,
not in the signature.
On Thu, Sep 22, 2016 at 1:02 PM, Alexander Belopolsky <
> On Thu, Sep 22, 2016 at 3:58 PM, David Mertz <me...@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
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/