Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
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

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
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 i

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Jack Diederich
On Thu, Jun 17, 2010 at 12:58 PM, 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 "fr

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
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 (implicit

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
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) consta

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
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

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: > Are there any efficiency or style guidelines regarding the choice > of "import " vs. "from import , ..."? There are no legitimate efficiency issues. In theory, module.blah is slightly slower then blah, but that "slightly" is largely irrelevant in gl

Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread python
Are there any efficiency or style guidelines regarding the choice of "import " vs. "from import , ..."? 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 require the ent