On Jan 25, 10:44 am, John Heenan <johnmhee...@gmail.com> wrote:
> The __call__ function of the Cache global class instance, cache, is

More confusion busting that is going off topic and should be placed in
a topic of its own that discusses style issues.

For those who are not adjusted to the 'web2py way', the above mention
of 'global class instance' might appear incorrect, impossible or at
the least, 'not the Python way', since no import is implied or
suggested. Globals, as conventionally understood, are frowned upon by
the Python hierarchy, much to the annoyance of those from just about
every other programming environment who work with involved projects. C/
C++ programmers can conventionally tuck away a global namespace with
preprocessor #include statements and files. Python equivalents are not
as straightforward since an import always involves executing a file
(the first time an import on a file is used).

Web2py favours exec over import. The global class instance, cache, is
placed in a dictionary that becomes the environment during an exec.

The line 'environment['cache'] = Cache(request)' appears in the file
compileapp.py.

Hence there is no import.

Ultimately this style leads to more elegance and productivity and
leads to less bugs. How much time is wasted wondering what has been
forgotten to import when coding with Django and irritating compile
errors appear?

John Heenan

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to