ENH: add new member function filter to Container class
Compare changes
Files
2@@ -78,7 +78,7 @@ Examples
@@ -100,7+100,7 @@
does not seem to be the case, because p3 is not matched. I don't like this behavior, because it does correspond to this logical operation which is quite complex: (property.id == pid OR property.id is None) AND (property.name == name OR property.name is None)
What happens if both attributes are None?
Just came to my mind: Why don't implement
.filter
using a lambda expression, e.g.:properties.filter(lambda pid, name: pid==101 and name=="Property 1")
This would be much clearer and render the internal behavior more transparent. Also I think the implementation will become much shorter.
@@ -126,7+126,7 @@
Is
pid
a good name?property_id
is probably less confusing.