-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.11.2
-
Component/s: BSON
-
None
The problem is that in all the cases of the normal `dict` or `OrderedDict` the returned object has a `set` interface, so this code should work for any `dict`:
```
from six import viewkeys
viewkeys(d) - {'a', 'b'}
```
The above code fails for Python3 with:
```
TypeError: unsupported operand type(s) for -: 'list' and 'set'
```
When using the `six.viewkeys()` it maps it to `viewkeys() for Python2 and `keys()` for Python3.
In Python2 `dict().viewkeys()` returns `dict_keys([])`.
In Python3 `dict().keys()` also returns `dict_keys([])`.
For Python2: `OrderedDict().viewkeys()` returns `KeysView(OrderedDict())`
For Python3: ``OrderedDict().keys()` returns `odict_keys([])`
The `SON` class returns `list` for `SON().keys()`.
- is related to
-
PYTHON-2884 Use dict instead of SON for internal command construction
- Closed
- related to
-
PYTHON-2501 Remove iteritems from son.SON
- Closed