> Thanks for your comments and help.
>
> I think adding sort order by key is a problem. For example:
>
> If you have a kind on which you have equals filters using fetch with limit,
> offset you don't need to use indexes. However if you use fetch_page, you
> need to create indexes for q_desc. If you have a big app and use indexes for
> any kind you'll quickly consume your index quotas.
OTOH the cost of using offset is not zero either -- you pay as much
for the skipped entities as for the results.
> In addition, this result,
>
> [1, 2, 3]
> [4, 5, 6]
> [6, 5, 4]
> [3, 2, 1]
>
> for me is not correct.
>
> I think if you show a grid to an user (1,2,3), the user clicks on next
> button and he views (4,5,6). Then If the user now clicks on previous button
> the user must view (1,2,3) instead of (3,2,1).
>
> Now I you use fetch with offset and limit you get this behaviour(1,2,3)->
> (4,5,6) <- (1,2,3), however with fetch_page and reversed cursor this not.
If you want to display the results as [3, 2, 1] just reverse the
results list in memory. [...].reverse() does the job in-line in O(N)
time with o extra space needed.
> I think, one option may be use fetch_page with positive or negative limit to
> simulate this behaviour. I don't know If this can be correct.
If you're proposing a feature change, underneath the implementation
would have to do all the same work. Consider fetch_page() a building
block that makes it possible to do the right thing, not necessarily
the most convenient thing (which would depend on the needs of a
particular app).
> Thanks for your time and for heard me.
> Regards.
> Moisés Belchín.
>
>
>
> 2012/9/24 Guido van Rossum <
gu...@google.com>