[issue27639] UserList.__getitem__ doesn't account for slices

Michael Blahay report at bugs.python.org
Mon May 6 15:30:41 EDT 2019


Michael Blahay <mblahay at gmail.com> added the comment:

Here is a test that more explicitly shows the problem. 

>>> from collections import UserList
>>> UserList([0,1,2,3,4,5])[0:2].__class__
<class 'list'>
>>> 

It can clearly be seen here that the return type of the slicing operator is list when it should, in this case, be UserList (or whatever class one is using that is derived from UserList).

----------
nosy: +mblahay

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27639>
_______________________________________


More information about the Python-bugs-list mailing list