Skip to content

Comment on Ask YC: Best practice for Python module imports?

Comments

My own preference is on a case-by-case basis, and typically depends on whether I'm importing a module specific to my application, like a model or logic library, and whether I only need it for one specific method.

Standard libraries I'm more likely to import globally, since I'm more likely to want to use them several times.

The most important thing is to figure out what works for you, and then be consistent about it.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.