On Tue, Jun 22, 2021 at 7:47 AM Jelle Zijlstra <jelle.zijlstra@gmail.com> wrote:
El lun, 21 jun 2021 a las 23:19, <ucodery@gmail.com> escribió;
I submitted https://github.com/python/typeshed/pull/5675 to fix this in typeshed. But I agree with your larger point that this would be easier if we had `Self`.
Thanks for this. I really had no idea how to get this annotation to work. In hindsight it’s more obvious. I wonder how many other typeshed classes don’t do this for methods that return self. It was only after seeing the solution that I could find docs describing it on mypy.readthedocs. There is a note claiming that a generic self is still experimental but maybe a convention should be added to the typeshed contributing guide about using it, just like Sequence is recommended over list.