Question

According to PEP 8 guidelines, "library specific imports" should come last at the import list. But what does this exactly mean?

Was it helpful?

Solution

You have misread it, it says:

"local application/library specific imports

where local applies to both application and library imports of your own (eg. your own libraries / classes).

OTHER TIPS

Imagine, you are developing a Twisted-application myapp that has modules A and B. And your code in myapp.A uses some functions from myapp.B. It also uses Twisted features and some built-in collections. That's how you structure your imports in A.py:

# Standard library imports first
from collections import defaultdict

# 3rd-party imports
from twisted.internet import reactor

# And now your own modules
from myapp.B import foo, bar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top