[New-bugs-announce] [issue30137] Equivalent syntax regarding List returns List objects with non-similar list elements.

Akshay Deogaonkar report at bugs.python.org
Sat Apr 22 10:01:58 EDT 2017


New submission from Akshay Deogaonkar:

lst = [0,1,2,3,4]
print(lst[0:3]) #returns [0,1,2]
print(lst[:3]) #returns [0,1,2]

#Above two syntax returns same lists.

print(lst[0:3:-1]) #returns []
print(lst[:3:-1]) #returns [4]

#Here is a bug; what expected was that the both syntax would have
returned the similar lists; however, they didn't!

----------
messages: 292120
nosy: Akshay Deogaonkar
priority: normal
severity: normal
status: open
title: Equivalent syntax regarding List returns List objects with non-similar list elements.
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30137>
_______________________________________


More information about the New-bugs-announce mailing list