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

Document missing trailing comma on function calls with unpacking on non-3.6 files #39

Closed
sanjioh opened this issue Mar 18, 2018 · 4 comments
Labels
good first issue Good for newcomers T: documentation Improvements to the docs (e.g. new topic, correction, etc)

Comments

@sanjioh
Copy link

sanjioh commented Mar 18, 2018

Howdy! Sorry you're having trouble. To expedite your experience,
provide some basics for me:

Operating system: Mac OS 10.13.3
Python version: 3.6.4
Black version: 18.3a2
Does also happen on master: Yes

To answer the last question, follow these steps:

  • create a new virtualenv (make sure it's the same Python version);
  • clone this repository;
  • run pip install -e .;
  • make sure it's sane by running python setup.py test; and
  • run black like you did last time.

Hi, and a huge thank you for this project!
I think I might have found a glitch in how function calls are formatted.

func_1(
    first_argument_with_a_very_long_name,
    second_argument_with_a_very_long_name,
    third_argument_with_a_very_long_name,
)
func_2(
    *first_argument_with_a_very_long_name,
    second_argument_with_a_very_long_name,
    third_argument_with_a_very_long_name
)

When an argument has the unpacking notation, black removes the trailing comma from the last one.
Is this intended behaviour?

Thanks again!

@ambv
Copy link
Collaborator

ambv commented Mar 18, 2018

This is missing because this style of trailing comma is not safe pre-3.6. If you want this, just put that trailing comma yourself, Black will keep it.

@ambv ambv changed the title Missing trailing comma on function calls with unpacking Document missing trailing comma on function calls with unpacking on non-3.6 files Mar 18, 2018
@ambv ambv added good first issue Good for newcomers T: documentation Improvements to the docs (e.g. new topic, correction, etc) labels Mar 18, 2018
@ambv
Copy link
Collaborator

ambv commented Mar 18, 2018

This behavior was introduced in f71fc78 and is documented there in the commit message. We need to put this in the README.

@sanjioh
Copy link
Author

sanjioh commented Mar 18, 2018

Great, thanks for the clarification.

@ambv ambv added this to To do in Amazing documentation Mar 21, 2018
@ambv
Copy link
Collaborator

ambv commented Mar 27, 2018

Fixed.

@ambv ambv closed this as completed Mar 27, 2018
@ambv ambv moved this from To do to Done in Amazing documentation Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers T: documentation Improvements to the docs (e.g. new topic, correction, etc)
Projects
Development

No branches or pull requests

2 participants