On 16 October 2012 07:19, Jacob Kaplan-Moss <ja...@jacobian.org> wrote: > On Mon, Oct 15, 2012 at 7:42 AM, Anssi Kääriäinen > <anssi.kaariai...@thl.fi> wrote: >> In the end this is a decision with almost no technical considerations and a >> lot of "good taste" considerations. So, this seems like BDFL area. > > Hi! > > After thinking a bit, I'm +1 on the idea, and I think > `Queryset.first()` is the right name (which implies we should probably > have a `last()` for completion). > > This mirrors the name used by a few other ORM/collection APIs that I > think have really nice APIS: > > * SQLalchemy > (http://docs.sqlalchemy.org/en/rel_0_7/orm/query.html#sqlalchemy.orm.query.Query.first) > * Storm > (http://people.canonical.com/~therve/storm/storm.store.ResultSet.html#first) > * Backbone (http://backbonejs.org/#Collection-Underscore-Methods / > http://documentcloud.github.com/underscore/#first)
To me, first() is something else -- it implies an order (Storm will raise an exception if you call first() on an result set without an order) and it implies that it will not raise if the query matches more than one object. I thought the API proposed here more closely resembled Storm's "one()" or SQLalchemy's "scalar()" (or maybe its just how "get()" works already in SQLAchemy). Not saying it wouldn't be useful, just different... Cheers, mwh -- 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 django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.