Changes between Version 49 and Version 50 of DeveloperGuidelines/Optimisation
- Timestamp:
- 06/18/10 09:29:21 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Optimisation
v49 v50 178 178 {{{ 179 179 for x in y: 180 if x.a == some_value or other_variable == other_value:180 if x.a == some_value: 181 181 record = db(db.mytable.id == x.key).select() 182 182 ...<branch 1> … … 189 189 190 190 {{{ 191 if other_variable == other_value: 192 ids1 = [x.key for x in y] 193 ids2 = [] 194 else: 195 ids1 = filter(lambda x: (x.a == some_value) and x.key or None, y) 196 ids2 = filter(lambda x: (x.a != some_value) and x.other_key or None, y) 191 ids1 = filter(lambda x: (x.a == some_value) and x.key or None, y) 192 ids2 = filter(lambda x: (x.a != some_value) and x.other_key or None, y) 197 193 if ids1: 198 194 records = db(db.mytable.id.belongs(ids1)).select() … … 208 204 DeveloperGuidelines 209 205 DeveloperGuidelines 206 DeveloperGuidelines