Skip to content

Instantly share code, notes, and snippets.

@tinnet
Last active April 18, 2016 12:24
Show Gist options
  • Save tinnet/a8e8f6055aaae9c4713dabc7863b01bf to your computer and use it in GitHub Desktop.
Save tinnet/a8e8f6055aaae9c4713dabc7863b01bf to your computer and use it in GitHub Desktop.
instance = {'_id': 'Eom0boo1iroo'}
if any(map(lambda hit: hit['_id'] != instance['_id'], hits)):
yield ValidationError(
'unique property {} conflicts with existing object: {}'.format(_ref, hit)
)
# vs.
for hit in hits:
if hit['_id'] != instance['_id']:
yield ValidationError(
'unique property {} conflicts with existing object: {}'.format(_ref, hit)
)
@sjaensch
Copy link

if any(hit['_id'] != instance['_id'] for hit in hits):
    yield ValidationError(
        'unique property {} conflicts with existing object: {}'.format(_ref, hit)
    )

@tinnet
Copy link
Author

tinnet commented Apr 18, 2016

❤️

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