PEP8 import conventions
<p>I'm trying to stick to the best practices when it comes to import modules, I'm trying to understand what <a href="https://www.python.org/dev/peps/pep-0008/#imports" rel="nofollow">PEP8</a> says about this. </p>

<p>Let's say my framework has hundred of classes and few dozen of packages. For instance, PyQt5 or sympy would be good candidates... what'd be the best choice from this set?</p>

<p><strong>a) Import everything</strong></p>

<pre><code>from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

print(QPoint)
print(QPixmap)
print(QApplication)
</code></pre>

<p><strong>b) Import only big packages and using prefixes for the whole application</strong></p>

<pre><code>from PyQt5 import QtCore, QtGui, QtWidgets

print(QtCore.QPoint)
print(QtGui.QPixmap)
print(QtWidgets.QApplication)
</code></pre>

<p><strong>c) Import specific classes from the big packages</strong></p>

<pre><code>from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication

print(QPoint)
print(QPixmap)
print(QApplication)
</code></pre>

<p>The option a) is discouraged by PEP8, what about b) or c)... what's the PEP8's recomendation about it?</p>

<p>There is no recommendation because it depends too much on your project, and what potential name clashes you may experience. If you don't already have a <code>QPoint</code> object (either of your own, or potentially from a different package), you may find it easier to read and write just the <code>QPoint</code> symbol where it is needed.</p>

<p>However, should you in the future interact with a different package that also provides a <code>QPoint</code>, you would need either to refer to them via their parent package, or use the <code>from PyQt5.QtCore import QPoint as PyQt5QPoint</code> syntax before referring to <code>PyQt5Point</code> in subsequent code.</p>

python pyqt pep8