On Wed, Jun 8, 2016 at 7:31 AM, Nagy László Zsolt <gand...@shopzeus.com> wrote:
>
>>>         pass
>>>
>>> NameError: name 'Test' is not defined
>> I think you can fix this by using a string annotation as follows:
>>
>>     class Test:
>>         def test(self, child: "Test"):
>>             pass
> Yes, you are right. It is not directly written in the official
> documentation ( https://docs.python.org/3/library/typing.html ), but it
> is in the PEP 0484, section "Forward references".

That link specifically documents the typing module. Forward references
don't really have anything to do with the typing module and are best
covered by the documentation of the static checker in use. Here's
where the MyPy documentation covers it:

http://mypy.readthedocs.io/en/latest/kinds_of_types.html#class-name-forward-references
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to