On 6/2/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > > On Jun 1, 11:57 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote: > > My point is, if the second number is lower than the first, shouldn't > > SQLAlchemy transform it into a query that returns no records? I.e., > > LIMIT 0, which MySQL at least allows. Because that's what the Python > > equivalent would do: > > > > >>> range(9999)[1420:20] > > [] > > this is like the argument with the empty in_() clause. i like to err > on the side of "no silent failures / assumptions". but i lost the > argument with the in_() clause, so im willing to lose the argument > here. even though i really think python should be raising an error > here too...why doesnt it ?
Because iterating when you're already past the end of something produces an empty result throughout Python. >>> range(10, 7) [] >>> range(10, 7, -1) [10, 9, 8] >>> it = iter([1, 2, 3]) >>> it.next() 1 >>> it.next() 2 >>> it.next() 3 >>> for i in it: ... print "Found", i ... >>> The last 'for' loop could raise an error, but it doesn't in Python or other languages, it just doesn't loop at all. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---