DEV Community

Discussion on: Python code formatting using Black

Collapse
 
nicolaerario profile image
Nicola Erario

Still with autopep8 here that I like over black for some array formatting behavior. However black really worth a try.

Collapse
 
notsag profile image
Maxime Gaston • Edited

Black also formats list and arrays, trying render a one liner expression if shorter than line-length or else putting one element per line :

# before:

numbers = [1,
     2,
     3
]

# after:

numbers = [1, 2, 3]

It also does the same for function parameters or statements.

Collapse
 
nicolaerario profile image
Nicola Erario

I perfectly know 😎