3 ms·
> How I import things (or the libraries I depend on!) affects how I can write my tests? Really? Well, no. Everything that needs to be understood is explained i
by scbrg 7y ago
> How I import things (or the libraries I depend on!) affects how I can write my tests? Really?
Well, no. Everything that needs to be understood is explained in the first section, A quick aside about assignment. Everything else is just discussion about logical consequences of this behavior.
If you do an assignment (and "from foo import bar" is an assignment) you're just creating another name for a value (in this case, you're creating a name foo, in your namespace (presumably, but not necessarily a module) that points at whatever the name foo in module bar happened to point at at the moment you created it). If the original (or should I say, one of the previous) name(s) to the value is reassigned that does not affect what your name is pointing at.
This is really all there is to know, and once you've grokked that, everything Python falls in place.