Skip to content

any() and all() to take a list as a condition#38

Merged
msiemens merged 5 commits intomsiemens:masterfrom
wearp:master
Nov 4, 2014
Merged

any() and all() to take a list as a condition#38
msiemens merged 5 commits intomsiemens:masterfrom
wearp:master

Conversation

@wearp
Copy link
Contributor

@wearp wearp commented Nov 1, 2014

Modified queries.py for any() and all() to take a list as condition. They still function along the lines of python's all() and any(). Inspired by mongodb's $all.

Examples:

where('followers').any(['don', 'jon'])
where('followers').all([{'name': 'john'}, {'age': 17}])

Tests are for free!

wearp added 2 commits November 1, 2014 12:47
	Modified any() and all() to accept & test arrays as arguments
@eugene-eeo
Copy link
Contributor

I think using callable instead of isinstance would be better since we can pass in sequences (tuples, sets, lists) as well.

@wearp
Copy link
Contributor Author

wearp commented Nov 2, 2014

Thanks - makes sense to me.

@msiemens
Copy link
Owner

msiemens commented Nov 3, 2014

Thanks, @wearp! Could you also update the docs (docs/usage.rst in particular) accordingly? If not, I'll do it.

@wearp
Copy link
Contributor Author

wearp commented Nov 4, 2014

No problem @msiemens! That's done.

msiemens added a commit that referenced this pull request Nov 4, 2014
any() and all() to take a list as a condition
@msiemens msiemens merged commit 9af9f95 into msiemens:master Nov 4, 2014
@msiemens
Copy link
Owner

msiemens commented Nov 4, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants