Use space separator before parenthesiszed expressions in comprehensions with leading comments. (#12282)

This commit is contained in:
Micha Reiser 2024-07-11 22:38:12 +02:00 committed by GitHub
parent d0298dc26d
commit bd01004a42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 274 additions and 6 deletions

View file

@ -105,3 +105,66 @@ aaaaaaaaaaaaaaaaaaaaa = [
# Parenthesized targets and iterators.
[x for (x) in y]
[x for x in (y)]
# Leading expression comments:
y = [
a
for (
# comment
a
) in (
# comment
x
)
if (
# asdasd
"askldaklsdnmklasmdlkasmdlkasmdlkasmdasd"
!= "as,mdnaskldmlkasdmlaksdmlkasdlkasdm"
and "zxcm,.nzxclm,zxnckmnzxckmnzxczxc" != "zxcasdasdlmnasdlknaslkdnmlaskdm"
)
if (
# comment
x
)
]
# Tuple target:
y = [
a
for
# comment
a, b
in x
if True
]
y = [
a
for (
# comment
a, b
)
in x
if True
]
y = [
a
for
# comment
a
in
# comment
x
if
# asdasd
"askldaklsdnmklasmdlkasmdlkasmdlkasmdasd"
!= "as,mdnaskldmlkasdmlaksdmlkasdlkasdm"
and "zxcm,.nzxclm,zxnckmnzxckmnzxczxc" != "zxcasdasdlmnasdlknaslkdnmlaskdm"
if
# comment
x
]