Added support for PEP 570 (#867) - #872
Conversation
asottile
left a comment
There was a problem hiding this comment.
code seems fine, can you make testsuite/python38.py with:
def f(a, /, b):
pass|
fwiw, this patch also fixes the problem, I don't know which one is more correct (there other "unary operators" covering the splat / etc. operations in this list (it's how named-only arguments aren't flagged): diff --git a/pycodestyle.py b/pycodestyle.py
index 6ad5456..a0c2898 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -112,7 +112,7 @@ REPORT_FORMAT = {
PyCF_ONLY_AST = 1024
SINGLETONS = frozenset(['False', 'None', 'True'])
KEYWORDS = frozenset(keyword.kwlist + ['print', 'async']) - SINGLETONS
-UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
+UNARY_OPERATORS = frozenset(['>>', '**', '*', '/', '+', '-'])
ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-'])
WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
# Warn for -> function annotation operator in py3.5+ (issue 803)
diff --git a/testsuite/python38.py b/testsuite/python38.py
new file mode 100644
index 0000000..2132cd5
--- /dev/null
+++ b/testsuite/python38.py
@@ -0,0 +1,2 @@
+def f(a, /, b):
+ pass |
|
Any updates on this? I'm having issues as well. |
Seems author is stale, should I/anyone else just create a new PR with a test added? |
|
I will add tests tonight |
|
Any update? |
| @@ -0,0 +1,3 @@ | |||
| #: Okay | |||
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
|
actually, looks like you'll need to rebase now since |
I think it is not a good idea 'cause in this case '/' is not an unary operator |
neither is |
|
Either way, since * and ** are allowed for unpacking in quite a few situations, it kind of makes sense to have them in that list, but |
|
|
|
Waiting for release |

See Issue #867 or https://www.python.org/dev/peps/pep-0570/