[Python-Dev] PEP 549: Instance Properties (aka: module properties) (original) (raw)

Ivan Levkivskyi levkivskyi at gmail.com
Thu Sep 14 17:04:55 EDT 2017


On 14 September 2017 at 23:02, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:

On 14 September 2017 at 22:07, Ethan Furman <ethan at stoneleaf.us> wrote:

For comparison's sake, what would the above look like using class assignment? And what is the performance difference?

FWIW I found a different solution: # file mod.py from typingextensions import allowforwardreferences allowforwardreferences() from mod import Vertex, Edge # the import is from this same module. It works both with class assignment and with getattr -- Ivan Anyway, I don't think we should take this seriously, the way forward is PEP 563, we should have clear separation between runtime context and type context. In the latter forward references are OK, but in the former, they are quite weird.

-- Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170914/60508f36/attachment.html>



More information about the Python-Dev mailing list