Open BigRoy opened 6 years ago
It seems to be coming from this line.
Refactoring it to:
if isinstance(item, (int, slice)):
Allows the slicing to function as in a regular Python list in both Python 2.7 and Python 3.6.
Why it's working without this in Python 2.7 on the other hand makes me confused now.
It seems in Python 2.7 that with slicing it never enters the __getitem__
function. :)
More info:
Issue
In our plug-ins we've been doing
context[:]
to get a copy of the instances list from the context, though in Python 3.6 this is giving us the following error:Confirmed and reproducable with:
This works in Python 2.7 - but raises the error above in Python 3.6.
Workaround
It does however work when doing
list(context)
to get a copy of the list.Shouldn't the first one also work if it "should behave" like a regular list?