Index: filters/find.py |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/filters/find.py |
@@ -0,0 +1,6 @@ |
+def find(sequence, value, attribute=None): |
+ for item in sequence: |
+ if ((attribute is None and item == value) or |
+ (attribute is not None and item[attribute] == value)): |
Sebastian Noack
2015/03/20 17:50:28
If you insist on keeping this weird filter, can we
Wladimir Palant
2015/03/20 18:22:40
Not that much simpler but fine with me.
Sebastian Noack
2015/03/21 12:34:44
Moreover, you should use environment.getitem(). Ot
saroyanm
2015/03/21 17:27:10
Done.
Wladimir Palant
2015/03/22 22:06:42
I doubt that this is a good idea. Environment.geti
saroyanm
2015/03/22 23:40:51
Done.
|
+ return item |
+ return None |