Are there any efficiency or style guidelines regarding the choice
of import module vs. from module import name, ...?
If one only needs to import a few names from a module, are there
specific benefits to explictly importing these names?
My understanding is that both forms of the import command
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote:
Are there any efficiency or style guidelines regarding the choice
of import module vs. from module import name, ...?
There are no legitimate efficiency issues. In theory, module.blah is
slightly slower then blah, but that slightly is largely
Stephen Hansen wrote:
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote:
Now, this is all IMHO: the style guide does not define any 'guidelines'
on this, except that its okay to use from ... import ... to pull in
classes and (implicitly) constants, and despite how the rules say 'one
module per line'
On 6/17/10 10:01 AM, Ethan Furman wrote:
Stephen Hansen wrote:
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote:
Now, this is all IMHO: the style guide does not define any 'guidelines'
on this, except that its okay to use from ... import ... to pull in
classes and (implicitly) constants, and
Stephen Hansen wrote:
On 6/17/10 10:01 AM, Ethan Furman wrote:
Stephen Hansen wrote:
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote:
Now, this is all IMHO: the style guide does not define any 'guidelines'
on this, except that its okay to use from ... import ... to pull in
classes and
On Thu, Jun 17, 2010 at 12:58 PM, Stephen Hansen
me+list/pyt...@ixokai.io wrote:
On 6/17/10 10:01 AM, Ethan Furman wrote:
Stephen Hansen wrote:
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote:
Now, this is all IMHO: the style guide does not define any 'guidelines'
on this, except that its okay
Jack Diederich wrote:
You want to import a name that is itself a namespace; preferably a
module or package and sometimes a class. Importing constants can lead
to trouble. ex/
from settings import DEBUG
if DEBUG: log('debug is on!')
The value of the flag gets fetched at import time. If code
On 6/17/10 10:22 AM, Jack Diederich wrote:
On Thu, Jun 17, 2010 at 12:58 PM, Stephen Hansen
It explicitly states later its entirely OK to import classes. It never
says anything else directly, except in the example given, it shows you
importing a constant. So, its giving implicit approval to