Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When an expression is in star-args, a space gets added #31

Closed
dhermes opened this issue Mar 15, 2018 · 1 comment
Closed

When an expression is in star-args, a space gets added #31

dhermes opened this issue Mar 15, 2018 · 1 comment

Comments

@dhermes
Copy link

dhermes commented Mar 15, 2018

For example, the expression gidgets[:2] is treated differently than gidgets when passed as star args.

For the file star_arg.py:

def f(*widgets):
    result = 0
    for widget in widgets:
        result += widget
    return result


def g(a, b, c, d):
    gidgets = (a, b, c)
    if d > 4:
        return f(*gidgets[:2])

    else:
        return f(*gidgets)

Running black (installed from HEAD as in #30) adds the space between the * and the star arg:

$ venv-HEAD/bin/black star_arg.py
reformatted star_arg.py

See the diff

diff --git a/star_arg.py b/star_arg.py
index e98997c..12ce82d 100644
--- a/star_arg.py
+++ b/star_arg.py
@@ -8,7 +8,7 @@ def f(*widgets):
 def g(a, b, c, d):
     gidgets = (a, b, c)
     if d > 4:
-        return f(*gidgets[:2])
+        return f(* gidgets[:2])

     else:
         return f(*gidgets)
dhermes added a commit to dhermes/bezier that referenced this issue Mar 16, 2018
Did so via

   $ venv/bin/black --line-length=79 $(git ls-files -- 'src/*.py')

I didn't just merge the changes as-is because some were invalid
(at least according to Pylint).

I filed a few issues based on things that didn't "comply":

- psf/black#30
- psf/black#31
- psf/black#32
- psf/black#33
@ambv ambv closed this as completed in 5131007 Mar 16, 2018
@ambv
Copy link
Collaborator

ambv commented Mar 16, 2018

Fixed!

ambv added a commit that referenced this issue Mar 19, 2018
This happened when the operand was a complex expression.

Fixes #31
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

No branches or pull requests

2 participants