Ok, I'm not sure why exclude is written completely different than find...
but it returns the exact same results :)
Given
Rows =
id name
1 hello
2 hello
3 hi
4 good morning
list = Rows.find(lambda row: row.name == 'hello')
YIELDS
1, 2
list = Rows.exclude(lambda row: row.name == 'hello')
SHOULD YIELD
3, 4
BUT ACTUALLY YIELDS
1, 2
Here is a correct, working version of exclude
def exclude(self,f):
"""
returns a set of rows of sorted elements (not filtered in place)
"""
if not self.records:
return []
records = []
for i in range(0,len(self)):
row = self[i]
if not f(row):
records.append(self.records[i])
return Rows(self.db,records,self.colnames)
-Thadeus
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.