On Sat, Nov 14, 2020 at 04:32:20AM +0000, Steve Barnes wrote:
I love the idea of __imported__ but would like to suggest taking it even further - why not, rather that a bool for __imported__, have the value of it be either None (if __name__ == "__main__")
What if you imported `__main__`?
or the __name__ of the module that it is being imported from.
What if it has been imported from many modules, as most modules will be?
This could potentially be useful in trying to resolve circular imports, imports via importlib or exec, etc.
"Potentially" useful? How?
By the way, exec doesn't do an import of the code being run.