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
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
therefore
I was under the impression that "from somemodule import someclass" would
always be
faster than import somemodule.

Is there a reason why I shouldn't?

If they belong together, put them in a package and use __init__.py. if
they don't belong together you are just obscuring the design for very
little savings.


Ok, so I will keep the code as is. Thank you Luke and Kent!

-Tino
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to