Neil Girdhar writes:

 > I agree that circularity should in general be avoided, but it's not always 
 > possible or elegant to do that.  Sometimes you really need two classes to 
 > refer to each other.  In that case, why not expose your placeholder idea to 
 > the user via a library?

Why not just expose it through a simple assignment?

https://mail.python.org/pipermail/python-ideas/2016-September/042563.html

Note that this also works for typechecking in PEP 484 checkers that
allow forward reference via the stringified class name.  See also
https://mail.python.org/pipermail/python-ideas/2016-September/042544.html,
which would allow eliding the assignment, but pollutes the class namespace.

"Simple is better than complex."

This feature is still looking for a persuasive use that needs it, and
not something simpler.

Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to