-
-
Save youknowone/9c498b62484af20b40381853543723f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bson | |
import ring | |
oid1 = bson.objectid.ObjectId(b'foo-bar-quux') | |
oid2 = bson.objectid.ObjectId(b'foo-bar-quxy') | |
oidx = bson.objectid.ObjectId(b'foo-bar-quux') | |
assert oid1 == oidx | |
assert oid1 is not oidx | |
assert oid1 != oid2 | |
@ring.lru() | |
def f(oid): | |
print('caching:', oid) | |
return oid | |
assert f(oid1) is oid1 | |
assert f(oid2) is oid2 | |
assert f(oidx) is oid1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment