Just to clarify, again, the following syntax:

[city for city in fance.City.list if \
city.Language is not spanish and city.Population.isGraterThan(1000000)]

Is not a pie-in-the-sky dream-API - there are implementational details that 
are viable for each section.

First, the reason the "is not" would work, is that there would exist an 
implementation of 'Identity Mapping" that would take care of having a 
singleton for each ORM-object representing each row.

Second, the access to france.City.list is viable, as an attribute-access is 
totally customization in python, so we can devise anything we want for the 
access to do.
For example, it could return an iterator, if the "City" attribute of the 
"france" ORM-object is "valid" (meaning, it is cached and not "invalidated" 
by a previous transaction-commit), and do a "query" right-there on the 
spot, and "return" an iterator, if the "City" attribute of the "france" 
ORM-object is "invalid" at the time of the "list" attribute access.

Lastly, the .isGraterThan() can easily be implemented in the ORM-class that 
would be generated out of the @ORM() class-decorator.
It is used for 3 purposes:
1. Readability
2. Beauty.
3. Conciseness.

When comparing this:

city.Language is not spanish and city.Population.isGraterThan(1000000)

With this:

db.Country.Name <http://db.country.name/> == 'France' and 
db.Country.id<http://db.country.id/> == 
db.City.country


The "Zen of Python" comes to mind:

 "Beautiful is better than ugly."

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to