On 15/01/2009, at 4:07 AM, Mark Ramm wrote:
> if tg.config.use_toscawidgets: > import tw > tw.framework.default_view = tg.config.tw.framework.default_view > > Makes sense, though you only want to do the import once, not on each > request. ;) > I was going to suggest that there should be no performance penalty when repeating an import as Python only imports a module once. But even though that is true, it looks like there is still the overhead of processing the import statement and checking whether the import is necessary, assigning the reference, etc. See http://wiki.python.org/moin/PythonSpeed/PerformanceTips#ImportStatementOverhead They suggest the use of a global for doing efficient lazy imports. Cheers, Chris Miles --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
