Kyle Jensen wrote:
> Where should 'import' statements be located?  Ie.
> 1) at the top of the file, or
> 2) in a function that requires the particular module?
>
> If its #2 -- what are the implications for import caching on GAE?

It doesn't affect import caching at all.  When the import statement is
executed, Python first looks for the module in the sys.modules
dictionary.  If it's not there then it loads the module and puts it
into the dictionary.   This happens regardless of where the import
statement is executed.

For most imports, I would recommend just doing them at the top of the
file.  For #2 to be worthwhile, the module needs to be both relatively
expensive to import and only used in a minority of requests.

                                          Ross Ridge

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to