First of all, I'll move them to the top, I'd say it's still controversial.


I completely agree with you if it's an app not with App Engine.

With App Engine, loading modules lazily like this is one of the best practices (or bad knowhow or whatever) in order to minimize the latencies of the loading requests.

If you have a handler which returns just a json object instead of a complete html, you don't need Jinja2 environment, and even Jinja2 dependencies. A similar thing on json import too.

It actually occurred to a real production app in the past that such unnecessary jinja2 import caused higher latencies for the loading requests(and even having DeadlineExceededErrors).