PEP: possibility of inline using of a symbol instead of "import"

Tim Harig usernet at ilthio.net
Thu Jan 6 10:57:46 EST 2011


On 2011-01-06, dmitrey <dmitrey.kroshko at scipy.org> wrote:
> and after several pages of code they are using somewhere, maybe only
> one time, e.g.
[SNIP]
> It makes programs less clear, you have to scroll several pages of code
> in IDE to understand what it refers to.

Python doesn't require imports to be at the top of a file.  They can be
imported at any time.

> import MyModule
> (...lots of code...)
> r = MyModule.myFunc(...)

(...lots of code...)
import MyModule
r = MyModule.myFunc(...)



More information about the Python-list mailing list