On 11/4/07, Brot <[EMAIL PROTECTED]> wrote:
>
> Ok, thank you... that's standard python stuff. It's no secret, that
> I'm new to python :-(
> But I found another solution. I don't really now which on is the
> better one?!
>
> partnerlist = [ep.partner for ep in
> Event.objects.latest
> ('date').eventpartner_set.all().select_related().order_by('hp_partner.name')]


Ah yes, that'll work too, it just didn't occur to me.  I suspect it might
also be more efficient, though that's just a gut feeling.  You could run
some little tests with timeit (http://docs.python.org/lib/module-timeit.html)
to find out.  Not that more efficient is necessarily best, unless this is a
critical code path where you're expecting to be sorting good-sized lists.
Readability/maintainability counts also, and you're the best judge of what's
most readable/maintainable for your code.

You're not alone in being new to Python with Django, that seems more common
than not around here (and was the case with me too).  But I've found Python
to be a powerful tool and well worth learning in some depth (though I'm
hardly an expert) in addition to Django.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to