Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Kent Johnson
Terry Carroll wrote: > On Thu, 19 Jul 2007, Kent Johnson wrote: > >> This is such a common optimization that Raymond Hettinger (the king of >> speed :-) wrote a decorator to do it automatically: > > Some day I'm going to have to figure out decorators. Well, that particular decorator is hairy, b

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Terry Carroll
On Thu, 19 Jul 2007, Kent Johnson wrote: > This is such a common optimization that Raymond Hettinger (the king of > speed :-) wrote a decorator to do it automatically: Some day I'm going to have to figure out decorators. ___ Tutor maillist - Tutor@p

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Kent Johnson
Terry Carroll wrote: > On Thu, 19 Jul 2007, Kent Johnson wrote: > >> Attribute lookup seems to have gotten better since Beazley wrote; here >> is a test program that uses three ways to access math.sqrt - module >> attribute, global name, local name. Note that in the third version, all >> three nam

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Terry Carroll
On Thu, 19 Jul 2007, Kent Johnson wrote: > Attribute lookup seems to have gotten better since Beazley wrote; here > is a test program that uses three ways to access math.sqrt - module > attribute, global name, local name. Note that in the third version, all > three names (sqrt, d, i) are local: .

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Kent Johnson
Tino Dai wrote: > Why do you expect a speedup? > > > In the Python Reference by David Beazley on p. 40, he substituted > import math > with from math import sqrt and he switched out d = d + math.sqrt(i) with > sqrt(i). He said that that change made the program run twice as fast. > So the

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
On 7/19/07, Eric Brunson <[EMAIL PROTECTED]> wrote: Tino Dai wrote: > On 7/19/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > > > The two advantages that I can see are, I don't need to type as > much, and > > there would be a speed up in the execution of

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Eric Brunson
Tino Dai wrote: > On 7/19/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > > > The two advantages that I can see are, I don't need to type as > much, and > > there would be a speed up in the execution of code. > > Why do you expect a speedup? > > > In th

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
For what purpose would you do this? For one thing: sheer laziness ;). But seriously, I though that if I abstracted all of those classes, it would be easier to maintain in the future. That is the real reason behind my wanting refactor that piece of code. -Tino

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
On 7/19/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > The two advantages that I can see are, I don't need to type as much, and > there would be a speed up in the execution of code. Why do you expect a speedup? In the Python Reference by David Beazley on p. 40, he substituted import math wi

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Kent Johnson
Tino Dai wrote: > Hi there Everybody, > >I have style question with importing of modules and classes. > Presently, I have several files importing several modules. > > #apacheModule > import dbBase > import dbCommon > import miscBase > > My question is there any advantage to me wrapping

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Luke Paireepinart
Tino Dai wrote: > Hi there Everybody, > >I have style question with importing of modules and classes. > Presently, I have several files importing several modules. > > #apacheModule > import dbBase > import dbCommon > import miscBase > > My question is there any advantage to me wrapping the

[Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
Hi there Everybody, I have style question with importing of modules and classes. Presently, I have several files importing several modules. #apacheModule import dbBase import dbCommon import miscBase My question is there any advantage to me wrapping them in a single file (wrapper), and th