I have recently have the opportunity to work on a Python web application.  I've 
found it beneficial to reduce duplicate code with the following code lines

import textwrap 
from pathlib import Path
exec(textwrap.dedent(Path('myfile.py').read_text()))

Perhaps such code could be the basis for a python_include() statement similar 
to how includes, requires work in PHP.

Thank you for any consideration.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EHZMYYYNQUT667Q3WJKDZA35PUJ5TXFW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to