Overview of features
Home
Read this first
About
web2py is 100% free
Download
Start learning web2py today
Documentation
Authors and contributors
Staff
Affiliated companies
Support
Edit page
Title:
Security Code:
Body:
(use
this
wiki markup)
Occasionally web2py has been criticized for using exec/execfile instead of import/reload for executing models and controllers. We argue that the web2py method is better for two reasons: - It allows to execute/import in a separate context, so there are no conflicts with class definitions and cleaner unloading of modules from memory. - It is faster. Benchmark below. The test code: import time open('a.py','w').write('a=True') import a t0=time.time() for i in range(10000): reload(a) print time.time()-t0 t0=time.time() for i in range(10000): execfile('a.py',{},{}) print time.time()-t0 Output: 3.61529898643 0.616114854813 Platform: Intel Macbook (2GHz CPU + 2GB Ram) Python 2.5.1