Lazy importing in python tool suite -


context: making command line tool suite launched git , of it's tools. commands run meke toolname --args

based on "why lazy import not default in python?" sounds case 1 of few useful places lazy importing. parse command line tool user run, import tool , pass along remaining arguments it's main function.

question: idea? there reasons should import front instead? or perhaps there better way structure whole suite entry point?

i pretty sure lazy imports better here. figure sanity check smart folks way prevent unforeseen complications or bad design practices. thanks.

assuming have fair number of non-trivial tools in suite, yes makes sense lazy imports. real benefit you'd targeting have more recursive imports of libraries tools depend on rather tools themselves, still makes worthwhile.

that said, why don't test out , see? can use timeit watch execution time , without lazy imports, , can @ this question discussion watching memory usage -- heapy seem default answer there. @ differences , see makes sense you.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -