On Sun, Apr 27, 2008 at 6:32 AM, Simon Willison <[EMAIL PROTECTED]> wrote:
>
>  On Apr 26, 12:33 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
>  wrote:
>
>  > If the aggregate function is provided as an anonymous argument (e.g.,
>  > Avg('height')), then the aggregate is asked to provide an appropriate
>  > alias - for example, Avg() might use 'avg__%s' % field_name. If the
>  > aggregate function is provided as a kwarg, the kwarg name is used as
>  > the alias.
>
>  Is it necessary to provide an anonymous argument syntax at all? Seeing
>  just annotate(Avg('height')) left me confused as to what the alias
>  would be until I read your further explanation. Is there any harm in
>  requiring the user of the API to always explicitly specify their alias
>  using keyword argument syntax? Unless there's a really good reason to
>  provide default aliases I think requiring explicit aliases would be
>  perfectly reasonable ("explicit is better than implicit").

Its mostly there as a convenience for the really simple cases. There
some duplication in typing annotate(avg_height=Avg('height'), so the
shortcut is a convenience. IMHO, this is the sort of thing could be
easily explained in the documentation for each aggregate function.

However, it's hardly a mandatory feature - if public opinion is
against this idea, I won't lose any sleep about it.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to