oggie rob wrote:
> Right, but what good is overriding len(..) if you have the list
> already? You've already fetched the records, right?
> As Jacob said before, when you say "get_article_count", you know that
> you are actually executing an SQL query. What is the case when you say
> reporter.articles? Is this a list already (from cache or from an SQL
> execution)?
> 
>  -rob
> 
> 
No no no. When you get access reporter.article_set , you get an object
that will allow you to :

* add new query parameters with .filter etc, returning itself
* do orthogonal methods like add
* call __iter__  and other collection methods, which will *then* trigger
the fetch from the database if it hasn't already happened.

Understand now?

Reply via email to