[Lldb-commits] [PATCH] D14342: Enable absolute imports in lldbsuite
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 5 09:55:19 PST 2015
zturner added a comment.
In http://reviews.llvm.org/D14342#282346, @tfiala wrote:
> Does this mean that if we import third party modules, and since you have embedded them into our package, that we would have to change third party code to adhere to our packaging structure? If not, fine. If so, this was one of the areas I mentioned that I was concerned about with the monolithic packaging structure.
No. I actually explicitly went out of my way to remove the third party packages from our package. That's why they are all in `lldb/third_party` now. `use_lldb_suite` adds all the third_party directories to `sys.path` up front, so you can still use absolute import syntax for this. i.e. `import six` will still just work, because it's in `sys.path`.
That said, the only place you have to use relative import syntax is to import stuff from within the same package. Plus, even in the hypothetical case where we did have that, as long as we don't write `from future import absolute_import` at the top of those packages' modules, they would still continue to work as they normally do.
It took me a while to wrap my head around this PEP, but now that I understand it, I think it's a good thing in principle, since it solves name collisions between your own modules and third-party / system modules by forcing you to make it explicit which one you want. Either you want a system / third-party module (e.g. `import foo`) or you want a module from within your current package (e.g. `from . import foo`)
http://reviews.llvm.org/D14342
More information about the lldb-commits
mailing list