Skip to content

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

Comments

My preference is to use

from x import y

inside any function that needs y.

OTOH I think there are good reasons to go with the official Python recommendation, which another poster says states that all imports should be at the top on separate lines.

AboutSource Built by g1lg1l

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