While it's different than you proposal, some people may like this
magic "smart imports" project which lazily imports a module when it's
used :-)

Project: https://pypi.org/project/smart-imports/

Replace:
---

import math
from my_project import calc
# 100500 other imports

def my_code(argument, function=calc):
    return math.log(function(argument))
---

with:
---
import smart_imports
smart_imports.all()
# no any other imports

def my_code(argument, function=calc):
    return math.log(function(argument))
---

I don't like it :-) I prefer explicit imports at the top!

Victor
_______________________________________________
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/KLXXAFVPY6RMGJVIFPJ5UNIXNO2YG472/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to