Abdur-Rahmaan Janhangeer <arj.pyt...@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.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to