importing module-performance

Chris Rebert clp2 at rebertia.com
Mon Feb 2 04:41:45 EST 2009


On Mon, Feb 2, 2009 at 1:29 AM, S.Selvam Siva <s.selvamsiva at gmail.com> wrote:
> Hi all,
> I have a small query,
> Consider there is a task A which i want to perform.
>
> To perform it ,i have two option.
> 1)Writing a small piece of code(approx. 50 lines) as efficient as possible.
> 2)import a suitable module to perform task A.
>
>
> I am eager to know,which method will produce best performance?

A. Your question seems much too vague to answer.
B. Premature optimization is the root of all evil. In all likelihood,
the time taken by the `import` will be absolutely trivial compared to
the rest of the script, so don't bother micro-optimizing ahead of
time; write readable code first, then worry about optimization once
it's working perfectly.

Cheers,
Chris
-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list