Python: `tr.get` returns something equals `None` but is not `None`
Open
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
Here is an example code:
```python
@fdb.transactional
def get_score(tr, user):
"""Return the score of the user.
Add the user to the leaderboard if they are not already there
"""
user_key = pack(('scores', user))
score = tr.get(user_key)
if score == None: # XXX: this use == instead of is because `score` is not `None`
# init the score at zero
score = 0
tr.set(user_key, pack((score,)))
tr.set(pack(('leaderboard', score, user)), b'')
else:
score = unpack(score)[0]
return score
```
This is misleading. `tr.get(b'foobar)` must return `None` if `b'foobar'` is not there
Contributor guide
Assessment
This issue has not been assessed yet.