16.06.20 21:02, Guido van Rossum пише:
It would certainly be much easier to get through the review process. Adding a `__filename__` (why not `__file__`?) attribute to classes is a major surgery, presumably requiring a PEP, and debating the pros and cons and performance implications and fixing a bunch of tests that don't expect this attribute, and so on. Adding an imperfect solution to inspect.getsource() would only require the cooperation of whoever maintains the inspect module.

If add the file name of the sources as a class attribute, we need also to add the line number (or the range of line numbers) of the class definition. Otherwise inspect.getsource() will still be ambiguous. Also, specifying the file name does not help in case of REPL or compiling a string, so maybe you need to attach full source text to a class?
_______________________________________________
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/3JUBWOYVLZGAOJJGHS7PM24WEOG24AJL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to