[New-bugs-announce] [issue4632] Wrong fix for range(42)[::-1]

Thomas Heller report at bugs.python.org
Thu Dec 11 13:01:57 CET 2008


New submission from Thomas Heller <theller at ctypes.org>:

The 2to3 fixer translates this code:
    range(42)[::-1]
into this one:
    list(range(42)[::-1]
which throws an error when run with Python 3:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    print(list(range(42)[::-1]))
TypeError: sequence index must be integer, not 'slice'

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 77604
nosy: theller
severity: normal
status: open
title: Wrong fix for range(42)[::-1]

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


More information about the New-bugs-announce mailing list