Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The answer to your question's title is "yes": I recommend never using <code>from ... import *</code>, and I discussed the reasons in another very recent answer. Briefly, qualified names are <em>good</em>, barenames are very limited, so the "third option" is optimal (as you'll be using qualified names, not barenames) among those you present.</p> <p>(Advantages of qualified names wrt barenames include ease of faking/mocking for testing purposes, reduced to nullified risk of unnoticed errors induced by accidental rebinding, ability to "semi-fake" the top name in a "tracing class" for the purpose of logging exactly what you're using and easing such activities as profiling, and so forth -- disadvantages, just about none... see also the last-but-not-least koan in the Zen of Python, <code>import this</code> at the interactive interpreter prompt).</p> <p>Equally good, if you grudge the 7 extra characters to say <code>QtCore.whatever</code>, is to abbreviate -- <code>from PyQt4 import QtCore as Cr</code> and <code>from PyQt4 import QtGi as Gu</code> (then use <code>Cr.blah</code> and <code>Gu.zorp</code>) or the like. Like all abbreviations, it's a style tradeoff between conciseness and clarity (would you rather name a variable <code>count_of_all_widgets_in_the_inventory</code>, <code>num_widgets</code>, or <code>x</code>? often the middle choice would be best, but not always;-).</p> <p>BTW, I would not use more than one <code>as</code> clause in a single <code>from</code> or <code>import</code> statement (could be confusing), I'd rather have multiple statements (also easier to debug if any import is giving problem, to edit if you change your imports in the future, ...).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload