How the Python import system works
tenthousandmeters.com
How the Python import system works
1–10 of 209 posts
Re: How the Python import system works
#2Re: How the Python import system works
#3Re: How the Python import system works
#4- three modules cannot depend on each other in a circular way
- relative imports are fragile ("module not found")
- the __all__ definitions in the __init__ file make modules available under different full names
- how to reload a module in a jupyter notebook if edited
and so on.
Re: How the Python import system works
#5I've been programming in Python professionally for more than five years. I consider myself quite a good programmer. I still don't have good grasp on Python's import system. Does anyone else have similar experience?
Re: How the Python import system works
#6I've been programming in Python professionally for more than five years. I consider myself quite a good programmer. I still don't have good grasp on Python's import system. Does anyone else have similar experience?
Re: How the Python import system works
#7Python importing quirks can be time consuming. Things beginners will encounter: - three modules cannot depend on each other in a circular way - relative imports are fragile ("module not found") - the __all__ definitions in the __init__ file make modules available under different full names - how to reload a module in a jupyter notebook if edited and so on.
What would the purpose of circular modules like this be? You may as well collapse into a single module and the situation would not be any different would it?
Re: How the Python import system works
#8I've been programming in Python professionally for more than five years. I consider myself quite a good programmer. I still don't have good grasp on Python's import system. Does anyone else have similar experience?
Re: How the Python import system works
#9I've been programming in Python professionally for more than five years. I consider myself quite a good programmer. I still don't have good grasp on Python's import system. Does anyone else have similar experience?
Re: How the Python import system works
#10Python importing quirks can be time consuming. Things beginners will encounter: - three modules cannot depend on each other in a circular way - relative imports are fragile ("module not found") - the __all__ definitions in the __init__ file make modules available under different full names - how to reload a module in a jupyter notebook if edited and so on.
When I do have a nasty circular dependency Webpack usually does a bad job telling me what’s wrong.
Though I should still treat circular imports as, at the very least, an organization code smell.