Is there a way to use a module without bringing its names into scope? I don’t need to extend any methods.
Specifically, using A brings type Foo into scope, but other code already defines Foo, so there is a name ambiguity and I actually don’t need A.Foo. I know I could do using A: x, y, z, but I’d rather just do A.x where needed because I don’t need much from A. The Summary of module usage makes it look like there’s no way to do what I want. For now I’m doing import A, but I don’t need to extend any methods, so that seems like a misuse. What’s the best way to do a Pythonic import? TIA.
I thought that import A still allows me to extend methods in A but only if I qualify them like A.x(y) = .... At least that’s what the Summary of module usage implies.
I find that construction useful when I want to be able to access foo from module A without pulling in the rest of its symbols, but I still want to be able to do A.bar().
No that has nothing to do with import. You can do that with using too. If the module is the only thing you need , just import, it’s the standard and most readable way.
Correct. As long as you have module M, you can always extend a function func in it with M.func. It doesn’t matter how you get the module. It can be imported, usinged, simply assigned as in M = ....