문제

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

도움이 되었습니까?

해결책

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

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top