Reading the reddit discusion, specifically the post of jacobian (one
of the Django creators) that says:

"I know that in your mind skipping imports is about "not repeating
yourself". But look guys: every single other Python program ever
written uses imports. By not including them you've basically made sure
that learning web2py is different from learning Python."

I would say this is incorrect, at least there are other kind of python
programs that doesn't use imports, see PL/Python, the PostgreSQL
Python procedural language:

 * Executes codes (uses PyEval_EvalCode, ops, doesn't import it...)
 * Doesn't need to import obvious modules (like plpy, the
PostgreSQL/Python interface)
 * Uses global variables to handle persistent data storage (GD, SD,
TD: global, sessiĆ³n and trigger dictionaries) and pass function
parameters! (like web2py controllers...)

Here is a minimal example:

CREATE FUNCTION say_hi (your_name TEXT) RETURNS VOID AS $$

plpy.notice("hello %s" % your_name)

$$ LANGUAGE plpythonu;

SELECT say_hi('mariano');

See the PostgreSQL documentation for detailed explanation of this "issues":
http://www.postgresql.org/docs/9.0/interactive/plpython-funcs.html

For Technical details refer to source code:
http://doxygen.postgresql.org/plpython_8c.html


With this I only want to help to demystify this negative appreciation
about web2py, surely there are many more examples like this as Python
is a dynamic language specially designed to execute and evaluate code
(i.e., OpenOffice/GIMP/etc. uses similar approach)

Anyone have more examples?
What do you think?

BTW, about the Python Zen rule "Explicit is better than implicit",
there is also "Although practicality beats purity.", and Python is a
practical language, or do we import len, list, dict...

>>> len(dir(__builtins__))
135


Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com

Reply via email to