I just wanted to point out that in the latest stable version of web.py,
there is still no __len__ attribute for ItterBetter... Would this be
appropriate to file as a bug?
On Thursday, June 14, 2007 1:14:49 PM UTC-4, Adam Atlas wrote:
>
>
> On 14 Jun 2007, at 04.38, Anand wrote:
> >
> > On 14-Jun-07, at 2:02 PM, Tzury wrote:
> >
> >>
> >> Yet, for 1000's of rows, making list for each request in order to
> >> check length considered is not recommended.
> >
> > d = web.query("SELECT COUNT(*) AS count FROM mytable")
> > print d[0].count
>
> DB-API 2.0 specifies that the Cursor object must have a `rowcount`
> attribute, specifying the number of rows returned by the last query.
> To safe effort from making lists or doing SELECT COUNT()s, we should
> update iterbetter so that it responds to __len__ and returns that value.
>
> I also think iterbetter should always try to see if the wrapped
> iterator has its own __len__, and if so, pass it on to that, but
> maybe its initializer could take a fallback value (to which web.query
> would pass the cursor's `rowcount` upon executing the query).
>
>
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.