On 23/04/22 6:41 pm, Mehdi2277 wrote:
If it's allowed that a forward class may be continued in a different module I do not see how type checker like mypy/pyright could handle that. Classes are generally viewed as closed and fully defined within type checker.

The way this kind of thing works in a statically typed language is that
the "forward" part of the definition contains all of the interface
information, so the type checker doesn't need to see the "continue"
part -- that only contains implementation.

What's being proposed here is to split the *interface* between two
class statements, and possibly different modules. That's very different.

The nearest thing I can think of in a statically typed language is the
"extension methods" of C#. The way it works there is if you want to
use any extension methods, you have to import both the module defining
the class and the module defining the extension methods.

Maybe here the client code should import the class from the module
containing the "continue class", and that module should import the
one containing the "forward class"? Would that still work to resolve
circularities?

--
Greg
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/BOO3TJ5V3LOXC2MMNFBUWIEGCNMZLKET/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to