Bug report
Bug description:
from collections import UserList
my_userlist = UserList([1, 2, 3])
my_dict = {'a': 10, 'b': 20}
print(my_userlist + my_dict)
print(my_dict + my_userlist)
my_userlist += my_dict
print(my_userlist)
my_userlist = UserList([1, 2, 3])
my_set = {5, 4}
print(my_userlist + my_set)
print(my_set + my_userlist)
my_userlist += my_set
print(my_userlist)
In Lib/collections/__init__.py, it will do self.__class__(self.data + list(other)), self.__class__(list(other) + self.data) and self.data += list(other). However, it allows other to by any iterable object, even if other is a dict object or a set object. Should this be fixed?
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Bug report
Bug description:
In
Lib/collections/__init__.py, it will doself.__class__(self.data + list(other)),self.__class__(list(other) + self.data)andself.data += list(other). However, it allowsotherto by any iterable object, even ifotheris adictobject or asetobject. Should this be fixed?CPython versions tested on:
3.12
Operating systems tested on:
Windows