Re: Do more imported objects affect performance

2008-12-11 Thread Kirk Strauser
At 2008-12-01T11:30:44Z, Nick Craig-Wood <[EMAIL PROTECTED]> writes: > Importing the module is actualy slower... If you import the name into > your namespace then there is only one lookup to do. If you import the > module there are two. Note that if you're importing the entire module but want t

Re: Do more imported objects affect performance

2008-12-03 Thread Nick Craig-Wood
On Tue, Dec 02, 2008 at 10:53:47PM -0500, Steve Holden wrote: > Pardon me for intruding, but timings here are entirely the wrong focus > for a Python newcomer. Given that imports are super-optimized (i.e. the > code in the module is only performed once) such a small difference in > timing is incons

Re: Do more imported objects affect performance

2008-12-02 Thread Steve Holden
Filip Gruszczyński wrote: [something I moved to after Nick's reply, where it belongs] > 2008/12/1 Nick Craig-Wood <[EMAIL PROTECTED]>: >> Rafe <[EMAIL PROTECTED]> wrote: >>> On Dec 1, 7:26?am, "Filip Gruszczy?ski" <[EMAIL PROTECTED]> wrote: I have following question: if I use from m

Re: Do more imported objects affect performance

2008-12-02 Thread Nick Craig-Wood
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 02 Dec 2008 11:12:31 +, Nick Craig-Wood wrote: > > > I prefer the "from module import function". That means that if "module" > > doesn't supply "function" it raises an exception at compile time, not > > run time when you try to run "module

Re: Do more imported objects affect performance

2008-12-02 Thread Steven D'Aprano
On Tue, 02 Dec 2008 11:12:31 +, Nick Craig-Wood wrote: > I prefer the "from module import function". That means that if "module" > doesn't supply "function" it raises an exception at compile time, not > run time when you try to run "module.function". Wanna bet? >>> def spam(): ... from

Re: Do more imported objects affect performance

2008-12-02 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : On Tue, Dec 02, 2008 at 11:24:29AM +0600, Taskinoor Hasan wrote: On Mon, Dec 1, 2008 at 8:21 PM, Filip Gruszczy?ski <[EMAIL PROTECTED]>wrote: I see. Thanks for a really good explanation, I like to know, how to do things in the proper way :) I always prefer to use imp

Re: Do more imported objects affect performance

2008-12-02 Thread Nick Craig-Wood
On Tue, Dec 02, 2008 at 11:24:29AM +0600, Taskinoor Hasan wrote: > On Mon, Dec 1, 2008 at 8:21 PM, Filip Gruszczy?ski <[EMAIL PROTECTED]>wrote: > > > I see. Thanks for a really good explanation, I like to know, how to do > > things in the proper way :) > > I always prefer to use import module and

Re: Do more imported objects affect performance

2008-12-01 Thread Taskinoor Hasan
On Mon, Dec 1, 2008 at 8:21 PM, Filip Gruszczyński <[EMAIL PROTECTED]>wrote: > I see. Thanks for a really good explanation, I like to know, how to do > things in the proper way :) I always prefer to use import module and then use module.function. The reason is simple. It makes the code more read

Re: Do more imported objects affect performance

2008-12-01 Thread Filip Gruszczyński
I see. Thanks for a really good explanation, I like to know, how to do things in the proper way :) 2008/12/1 Nick Craig-Wood <[EMAIL PROTECTED]>: > Rafe <[EMAIL PROTECTED]> wrote: >> On Dec 1, 7:26?am, "Filip Gruszczy?ski" <[EMAIL PROTECTED]> wrote: >> > I have following question: if I use >> > >

Re: Do more imported objects affect performance

2008-12-01 Thread Nick Craig-Wood
Rafe <[EMAIL PROTECTED]> wrote: > On Dec 1, 7:26?am, "Filip Gruszczy?ski" <[EMAIL PROTECTED]> wrote: > > I have following question: if I use > > > > from module import * > > > > instead > > > > from module import Class > > > > am I affecting performance of my program? I believe, that all those > >

Re: Do more imported objects affect performance

2008-12-01 Thread Rafe
On Dec 1, 7:26 am, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote: > I have following question: if I use > > from module import * > > instead > > from module import Class > > am I affecting performance of my program? I believe, that all those > names must be stored somewhere, when they are imported

Re: Do more imported objects affect performance

2008-11-30 Thread MRAB
Filip Gruszczyński wrote: I have following question: if I use from module import * instead from module import Class am I affecting performance of my program? I believe, that all those names must be stored somewhere, when they are imported and then browsed when one of them is called. So am I p

Do more imported objects affect performance

2008-11-30 Thread Filip Gruszczyński
I have following question: if I use from module import * instead from module import Class am I affecting performance of my program? I believe, that all those names must be stored somewhere, when they are imported and then browsed when one of them is called. So am I putting a lot of "garbage" to