Frage

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

War es hilfreich?

Lösung

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).

Andere Tipps

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top