import in code
dieter
dieter at handshake.de
Sun Jul 22 00:55:50 EDT 2018
Abdur-Rahmaan Janhangeer <arj.python at gmail.com> writes:
> i have found some reputable books that include import within code
>
> with ...
> import x
>
> if ...
> import y
>
> def ...
> import z
>
> according to me they should be placed at the top. but an advantage of it is
> optimisation where you only load modules if necessary
Such "local" imports are sometimes important to avoid
circular imports.
More information about the Python-list
mailing list