Function argument splitting differently, given default args
See original GitHub issueGiven:
def long_function_name(var_one, var_two, var_three, var_four, var_five, var_six):
print(var_one)
yapf --style=pep8 -d longfunc.py
returns:
--- longfunc.py (original)
+++ longfunc.py (reformatted)
@@ -1,2 +1,3 @@
-def long_function_name(var_one, var_two, var_three, var_four, var_five, var_six):
+def long_function_name(var_one, var_two, var_three, var_four, var_five,
+ var_six):
print(var_one)
But when there is at least one default argument:
def long_function_name(var_one, var_two, var_three, var_four, var_five, var_six=1):
print(var_one)
yapf --style=pep8 -d longfunc.py
returns:
--- longfunc.py (original)
+++ longfunc.py (reformatted)
@@ -1,2 +1,7 @@
-def long_function_name(var_one, var_two, var_three, var_four, var_five, var_six=1):
+def long_function_name(var_one,
+ var_two,
+ var_three,
+ var_four,
+ var_five,
+ var_six=1):
print(var_one)
Is this as intended? Is there currently any way to force argument splitting to always work as in the first example?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Split up `...` arguments and distribute to multiple functions
An alternative approach is to provide default values for all noncommon arguments. In general, trying to send the ellipsis args to more than...
Read more >Python .split() – Splitting a String in Python - freeCodeCamp
split () method accepts, then by default, it will split the string every time it encounters whitespace until the string comes to an...
Read more >Function to facilitate the control of arguments passed to... - R
Many R functions need to pass several arguments to several different subroutines. ... SmartControl(call, keys, ignore, defaults, forced, split, ignore.case ...
Read more >Understanding Default Parameters in JavaScript - DigitalOcean
In this article, you will review the difference between parameters and arguments, learn how to use default parameters in functions, see ...
Read more >Default Arguments in C++ - GeeksforGeeks
A default argument is a value provided in a function declaration that is automatically assigned by the compiler if the calling function ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Setting
SPLIT_BEFORE_NAMED_ASSIGNS=False
will format the second example similarly to the first:Thank you. 😃