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

New lines for generics in functions #4534

Closed
framunoz opened this issue Dec 17, 2024 · 3 comments
Closed

New lines for generics in functions #4534

framunoz opened this issue Dec 17, 2024 · 3 comments
Labels
T: enhancement New feature or request

Comments

@framunoz
Copy link

framunoz commented Dec 17, 2024

Is your feature request related to a problem? Please describe.

I have noticed that when writing functions with generics, black splits the generics into more space. This is frustrating, as it makes it harder to read. Also, I feel it goes against black's philosophy, as black always tries to minimise space whenever possible.

For example, instead of writing a function like:

def foo[TypeA](
    input_a: TypeA,
    input_b: TypeA,
    input_c,
    input_d,
    input_e,
    input_f,
    input_g,
    input_h,
    input_i,
) -> list[TypeA]: ...

Black formats like this:

def foo[
    TypeA
](
    input_a: TypeA,
    input_b: TypeA,
    input_c,
    input_d,
    input_e,
    input_f,
    input_g,
    input_h,
    input_i,
) -> list[TypeA]: ...

Describe the solution you'd like

I would like to consider having a format like the one in the first code cell, to make it more concise.

@framunoz framunoz added the T: enhancement New feature or request label Dec 17, 2024
@MeGaGiGaGon
Copy link
Collaborator

This looks to be a duplicate of #4254

@framunoz
Copy link
Author

@MeGaGiGaGon Yep, it is. At least, the expected behaviour is the mentioned in that Issue.

@hauntsaninja
Copy link
Collaborator

Duplicate of #4071 , PR welcome

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants