question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Black 19.10b0 breaks subscript with 1D tuple

See original GitHub issue

Black v19.10b0

Playground link

This should be left alone:

a = a[:2,]

But it becomes:

a = a[
    :2,
]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Rysiascommented, Oct 11, 2021

I seem to still have this issue with version 21.9b0

1reaction
jorisvandenbosschecommented, Nov 11, 2019

Note that several explanations in the black docs / README are also no longer correct (if it is the intention to keep this specific change).

Eg in the section on “Trailing commas”:

One exception to removing trailing commas is tuple expressions with just one element. In this case Black won’t touch the single trailing comma as this would unexpectedly change the underlying data type. Note that this is also the case when commas are used while indexing. This is a tuple in disguise: numpy_array[3, ].

or in “How Black wraps lines”:

As for vertical whitespace, Black tries to render one full expression or simple statement per line. If this fits the allotted line length, great.

# in:

j = [1,
    2,
    3,
]

# out:

j = [1, 2, 3]
Read more comments on GitHub >

github_iconTop Results From Across the Web

https://openi.pcl.ac.cn/OpenI/MegEngine/commit/6b3...
Optional[Tracer]): + args = tuple(i if isinstance(i, Tracer) else None for i in ... + break + if __new__ is not None: +...
Read more >
https://mirrors.zju.edu.cn/opensuse/history/202001...
Instead is the set consisting of the empty tuple. + Deprecated tensorhead() and tensorsymmetry() static methods.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found