import in code

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Sat Jul 21 22:43:13 EDT 2018


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

so, import within code can be called unpythonic?

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
Mauritius


More information about the Python-list mailing list