On 12/12/05, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
> I think all in all it's a good idea, but I do have one big objection:
> one of the things that's always bugged me about ORMs is that they
> shield you from knowing when you're hitting the database.  This sucks
> when it comes time to optimize because you can't always tell what
> methods are "slow" and which are "fast."
>
> One thing I love about Django's ORM is that you always know when
> you're hitting the database: if the method starts with "get", then
> it's a database hit.  Easy and simple.

Another, somewhat related thing that struck me as I thought about it
some more was how to manage the difference between, say, get_list()
and get_iterator(); being able to switch between them as needed is
awfully important, and I've been trying, and failing, to think of an
elegant way to do so with this syntax.

> I agree that len(reporter.articles) is more pythonic, but at the same
> time it's not as accessible from the template.

I was thinking {{ reporter.articles.len }} might be the way to get at
it from templates -- this isn't exactly Pythonic, but it's nicer to
look at than {{ reporter.articles.__len__ }}.

> I guess in essence it comes down to whether we'd rather be explicit
> (reporter.get_article_list()), or "pythonic" (reporter.article_list)...

Hm. Isn't being explicit part of being Pythonic? It's a puzzler.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

Reply via email to