[issue43580] A Question about List Slice

2021-03-21 Thread Mark Dickinson
Change by Mark Dickinson : -- components: -Regular Expressions ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue43580] A Question about List Slice

2021-03-21 Thread Mark Dickinson
Mark Dickinson added the comment: It's behaving as designed and documented; see the docs here: https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range (and particularly note 3). In your first example, the first `-1` in `x[1:-1:-1]` is interpreted relative to the end

[issue43580] A Question about List Slice

2021-03-21 Thread LittleGuy
New submission from LittleGuy <674980...@qq.com>: # There is a question when I use list. # If I run this following code: x = list(range(10)) a = x[1 : -1 : -1] print(a) # the answer will be: [] # the right answer should be: [1, 0] # But in some cases, it works well, like: a = x[4 : 2 : -1]