Skip to content

"key" argument of builtin function sorted should be optional in python 2.7 - #3086

Merged
JelleZijlstra merged 2 commits into
python:masterfrom
chadrik:sorted_optional_key
Jun 22, 2019
Merged

JelleZijlstra merged 2 commits into
python:masterfrom
chadrik:sorted_optional_key

Conversation

@chadrik

@chadrik chadrik commented Jun 22, 2019

Copy link
Copy Markdown
Contributor

It is correctly marked as optional in python 3+, but not in python 2.7.

I test this with 2.7.10:

chad$ python
Python 2.7.10 (default, Oct  6 2017, 22:29:07) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> sorted([1,4,67,8], key=None)
[1, 4, 8, 67]
>>>

@JelleZijlstra

Copy link
Copy Markdown
Member

Looks good, but you'll also have to change stdlib/2and3/builtins.pyi.

@chadrik

chadrik commented Jun 22, 2019

Copy link
Copy Markdown
Contributor Author

fixed

@JelleZijlstra
JelleZijlstra merged commit e25c0cb into python:master Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants