[New-bugs-announce] [issue43580] A Question about List Slice

LittleGuy report at bugs.python.org
Sun Mar 21 05:07:50 EDT 2021


New submission from LittleGuy <674980165 at 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]
print(a)

# the answer will be:
[4, 3]

# so, there may be some problems.

----------
components: Regular Expressions
messages: 389220
nosy: YangS007, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: A Question about List Slice
type: behavior
versions: Python 3.8

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


More information about the New-bugs-announce mailing list