Hi all,

We struggled to get a proper definition for a first() and last() method vs. 
earliest() and latest() . I'd like to make one proposal. After that, I 
really like your opinion on which syntax you prefer.

First, let me give you a lenghty introduction. We discussed several use 
cases on this mailing 
list<https://groups.google.com/forum/?fromgroups=#!searchin/django-developers/get_default/django-developers/3RwDxWKPZ_A/mPtAlQ2b0DwJ>.
 
Then, I realized that:

.filter(last_name__startswith='b').order_by('last_name').first()
is an acceptable compromise for me to use in stead of:
.first(last_name__startswith='b').order_by('last_name')

Last weekend Aymeric explained to me that earliest can actually accomplish 
the same:
.filter(last_name__startswith='b').earliest('last_name')

Then, I find "earliest" an inappropriate name, because it does not describe 
functioning well.

Therefore, my proposal is, if we are going to implement the earliest and 
latest method, we should definitely rename them to: first and latest.

After that, there is only one question left:

Which style do you prefer?

.filter(last_name__startswith='b').order_by('last_name').first()    # clear 
and long
.first(last_name__startswith='b').order_by('last_name')    # first method 
has filter syntax.
.filter(last_name__startswith='b').first('last_name')   # first method has 
order_by syntax.

So, what do you think?

Best regards,

Wim

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to