New submission from meng_xiaohui <1294886...@qq.com>:

There is a bug in this method:

L.sort(key=None, reverse=False) -> None
L is an instance of list.

Argument key is a function. If L is in the body of argument key, L is always an 
empty list in test case, which is wrong

=================
Run this:

F = ['2', '3', '1']
G = ['7', '9', '8']

def key(i):
    print(F)
    print(G)
    res = int(i) + len(F) + len(G)
    return res

G.sort(key=key)
F.sort(key=key)

=================
Actual output:
['2', '3', '1']
[]
['2', '3', '1']
[]
['2', '3', '1']
[]
[]
['7', '8', '9']
[]
['7', '8', '9']
[]
['7', '8', '9']

----------
components: Interpreter Core
messages: 401679
nosy: meng_xiaohui
priority: normal
severity: normal
status: open
title: List.sort ERROR
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45179>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to