On Mon, Sep 17 2012, Michal Nazarewicz wrote: >> Michal Nazarewicz <mina86@mina86.com> writes: >>> IMO this is totally unintuitive and not how the range should work. >>> date:foo..bar should return messages whose date >= foo and < bar. So >>> for instance date:november..yesterday should return messages whose date >>> is > 2012/11/01 00:00:00 and < 2012/09/12 00:00:00. So to get >>> yesterdays messages one would do: date:yesterday..today. > > On Thu, Sep 13 2012, David Bremner wrote: >> I don't find ranges being half-open by default to be very >> intuitive. Perhaps I don't program in python enough. > > Perhaps C than: “for (i = 0; i < 10; ++i)” is the standard idiom and the > end range is open. > > Let's take a look at: > > date:2012/01/01..2012/01/01 + 1 day > > in my opinion, that should give results from the first of January only, > since “+ 1 day” indicates in a way how long user want the period to be. > > I think it's also easier to pragmatically create ranges. For instance, > let's say you want to create ranges for each week, you'd end up with: > > date:2012/01/02..2012/01/09 ## 2012w01 > date:2012/01/09..2012/01/16 ## 2012w02 > date:2012/01/16..2012/01/23 ## 2012w03 Ok, these matches with ISO Week... > Notice how the opening date of a range matches the closing date of > the previous date. 2012/01/02 is monday 2012/01/09 is monday. For me date:2012/01/02..2012/01/08 ## 2012w01 would be more intuitive in this context. for (i = 0; i < 10; ++i) loops through 0 - 9. for (i = 1; i <= 10; ++i) loops through 1 - 10. python -c 'for f in range(5): print f' prints 0 - 4 perl -le 'for (1..5) { print $_ }' prints 1 - 5 ... these does not clarify, but confuses these intuitions :D > > -- > Best regards, _ _ > ..o | Computer Science, Michał “mina86” Nazarewicz (o o) Tomi