Basic import Questions (with bonus profiling question)

  • Thread starter =?ISO-8859-1?Q?Gregory_Pi=F1ero?=
  • Start date
?

=?ISO-8859-1?Q?Gregory_Pi=F1ero?=

Hey Folks,

Some import questions that a search didn't turn up for me.

1. Will "from somemodule import onething" take as long to start up as
import somemodule?
2. Is there anyway I can get at onething more quickly?
3. If I put an import statement hidden away in some function, will
Python only do the import when that function is called? If I say,
never use that function would that import statement affect performance
at all?

Ultimately I have IIS running python as a CGI script and it seems to
just be taking many seconds to load a small page. I'm guessing the
issue is starting up the interpreter and loading all the modules.

BTW I know it would be better to profile the code but how do you
profile a CGI script? I can't just pass it CGI parameters can I? And
does profiling take into account the time of loading modules?

Thanks,

-Greg Pinero
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top