All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
14 True and False and None
15 (Name1 and Name2) or Name3
16 Name1 and Name2 or Name3
17 Name1 or (Name2 and Name3)
18 Name1 or Name2 and Name3
19 (Name1 and Name2) or (Name3 and Name4)
20 Name1 and Name2 or Name3 and Name4
21 Name1 or (Name2 and Name3) or Name4
22 Name1 or Name2 and Name3 or Name4
26 1 + v2 - v3 * 4 ^ 5 ** v6 / 7 // 8
27 ((1 + v2) - (v3 * 4)) ^ (((5 ** v6) / 7) // 8)
32 ~int and not v1 ^ 123 + v2 | True
33 (~int) and (not ((v1 ^ (123 + v2)) | True))
34 flags & ~ select.EPOLLIN and waiters.write_task is not None
37 lambda a, b, c=True: a
38 lambda a, b, c=True, *, d=(1 << v2), e='str': a
39 lambda a, b, c=True, *vararg, d=(v1 << 2), e='str', **kwargs: a + b
40 manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
41 foo = (lambda port_id, ignore_missing: {"port1": port1_resource, "port2": port2_resource}[port_id])
43 str or None if True else str or bytes or None
44 (str or None) if True else (str or bytes or None)
45 str or None if (1 if True else 2) else str or bytes or None
46 (str or None) if (1 if True else 2) else (str or bytes or None)
47 ((super_long_variable_name or None) if (1 if super_long_test_name else 2) else (str or bytes or None))
48 {'2.7': dead, '3.7': (long_live or die_hard)}
49 {'2.7': dead, '3.7': (long_live or die_hard), **{'3.6': verygood}}
51 {'2.7', '3.6', '3.7', '3.8', '3.9', ('4.0' if gilectomy else '3.10')}
52 ({'a': 'b'}, (True or False), (+value), 'string', b'bytes') or None
58 [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
64 [this_is_a_very_long_variable_which_will_force_a_delimiter_split, element, another, *more]
65 {i for i in (1, 2, 3)}
66 {(i ** 2) for i in (1, 2, 3)}
67 {(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))}
68 {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
69 [i for i in (1, 2, 3)]
70 [(i ** 2) for i in (1, 2, 3)]
71 [(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))]
72 [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
73 {i: 0 for i in (1, 2, 3)}
74 {i: j for i, j in ((1, 'a'), (2, 'b'), (3, 'c'))}
75 {a: b * 2 for a, b in dictionary.items()}
76 {a: b * -2 for a, b in dictionary.items()}
77 {k: v for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension}
78 Python3 > Python2 > COBOL
83 call(arg, kwarg='hey')
84 call(arg, another, kwarg='hey', **kwargs)
85 call(this_is_a_very_long_variable_which_will_force_a_delimiter_split, arg, another, kwarg='hey', **kwargs) # note: no trailing comma pre-3.6
88 call(**self.screen_kwargs)
89 call(b, **self.screen_kwargs)
98 tuple[str, int, float, dict[str, int],]
99 very_long_variable_name_filters: t.List[
100 t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
102 xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
103 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
105 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
106 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
108 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
110 ] = classmethod(sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)) # type: ignore
129 numpy[:, (0, 1, 2, 5)]
137 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
138 {'2.7': dead, '3.7': long_live or die_hard}
139 {'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
140 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
144 (i for i in (1, 2, 3))
145 ((i ** 2) for i in (1, 2, 3))
146 ((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
147 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
149 {"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
155 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
156 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
157 result = session.query(models.Customer.id).filter(models.Customer.account_id == account_id, models.Customer.email == email_address).order_by(models.Customer.id.asc(),).all()
159 authors.łukasz.say_thanks()
161 A: 0.25 * (10.0 / 12),
162 B: 0.1 * (10.0 / 12),
163 C: 0.1 * (10.0 / 12),
164 D: 0.1 * (10.0 / 12),
168 yield from outside_of_generator
172 await some.complicated[0].call(with_args=(True or (1 is not 1)))
174 print(**{1: 3} if False else {x: x for x in range(3)})
176 assert(not Test),("Short message")
177 assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
178 assert(((parens is TooMany)))
179 for x, in (1,), (2,), (3,): ...
181 for z in (i for i in (1, 2, 3)): ...
182 for i in (call()): ...
183 for j in (1 + (2 + 3)): ...
184 while(this and that): ...
185 a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
186 a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
187 a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
188 a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
190 threading.current_thread() != threading.main_thread() and
191 threading.current_thread() != threading.main_thread() or
192 signal.getsignal(signal.SIGINT) != signal.default_int_handler
196 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
197 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
201 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
202 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
206 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
207 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
211 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
212 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
216 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
217 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
221 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
222 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
226 ~ aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
230 ~ aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
234 ~ aaaaaaaaaaaaaaaa.a + aaaaaaaaaaaaaaaa.b - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h ^ aaaaaaaaaaaaaaaa.i << aaaaaaaaaaaaaaaa.k >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
238 # standalone comment at ENDMARKER
255 True or False or None
257 True and False and None
258 (Name1 and Name2) or Name3
259 Name1 and Name2 or Name3
260 Name1 or (Name2 and Name3)
261 Name1 or Name2 and Name3
262 (Name1 and Name2) or (Name3 and Name4)
263 Name1 and Name2 or Name3 and Name4
264 Name1 or (Name2 and Name3) or Name4
265 Name1 or Name2 and Name3 or Name4
269 1 + v2 - v3 * 4 ^ 5 ** v6 / 7 // 8
270 ((1 + v2) - (v3 * 4)) ^ (((5 ** v6) / 7) // 8)
275 ~int and not v1 ^ 123 + v2 | True
276 (~int) and (not ((v1 ^ (123 + v2)) | True))
277 flags & ~select.EPOLLIN and waiters.write_task is not None
280 lambda a, b, c=True: a
281 lambda a, b, c=True, *, d=(1 << v2), e="str": a
282 lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
283 manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
284 foo = lambda port_id, ignore_missing: {
285 "port1": port1_resource,
286 "port2": port2_resource,
289 str or None if True else str or bytes or None
290 (str or None) if True else (str or bytes or None)
291 str or None if (1 if True else 2) else str or bytes or None
292 (str or None) if (1 if True else 2) else (str or bytes or None)
294 (super_long_variable_name or None)
295 if (1 if super_long_test_name else 2)
296 else (str or bytes or None)
298 {"2.7": dead, "3.7": (long_live or die_hard)}
299 {"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
301 {"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
302 ({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
308 [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
315 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
320 {i for i in (1, 2, 3)}
321 {(i ** 2) for i in (1, 2, 3)}
322 {(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
323 {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
324 [i for i in (1, 2, 3)]
325 [(i ** 2) for i in (1, 2, 3)]
326 [(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
327 [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
328 {i: 0 for i in (1, 2, 3)}
329 {i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
330 {a: b * 2 for a, b in dictionary.items()}
331 {a: b * -2 for a, b in dictionary.items()}
334 for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
336 Python3 > Python2 > COBOL
341 call(arg, kwarg="hey")
342 call(arg, another, kwarg="hey", **kwargs)
344 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
349 ) # note: no trailing comma pre-3.6
351 call(a, *gidgets[:2])
352 call(**self.screen_kwargs)
353 call(b, **self.screen_kwargs)
362 tuple[str, int, float, dict[str, int]]
363 very_long_variable_name_filters: t.List[
364 t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
366 xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
367 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
369 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
371 ] = classmethod( # type: ignore
372 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
374 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(
375 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
395 numpy[:, (0, 1, 2, 5)]
403 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
404 {"2.7": dead, "3.7": long_live or die_hard}
405 {"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
406 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
410 (i for i in (1, 2, 3))
411 ((i ** 2) for i in (1, 2, 3))
412 ((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
413 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
419 "ended_at": now() + timedelta(days=10),
421 "import_session_id": 1,
429 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
432 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
436 session.query(models.Customer.id)
438 models.Customer.account_id == account_id, models.Customer.email == email_address
440 .order_by(models.Customer.id.asc())
444 authors.łukasz.say_thanks()
446 A: 0.25 * (10.0 / 12),
447 B: 0.1 * (10.0 / 12),
448 C: 0.1 * (10.0 / 12),
449 D: 0.1 * (10.0 / 12),
454 yield from outside_of_generator
459 await some.complicated[0].call(with_args=(True or (1 is not 1)))
463 print(**{1: 3} if False else {x: x for x in range(3)})
465 assert not Test, "Short message"
466 assert this is ComplexTest and not requirements.fit_in_a_single_line(
469 assert parens is TooMany
470 for (x,) in (1,), (2,), (3,):
474 for z in (i for i in (1, 2, 3)):
478 for j in 1 + (2 + 3):
483 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
484 in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
487 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
488 not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
491 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
492 is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
495 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
496 is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
499 threading.current_thread() != threading.main_thread()
500 and threading.current_thread() != threading.main_thread()
501 or signal.getsignal(signal.SIGINT) != signal.default_int_handler
505 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
506 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
510 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
511 & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
515 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
516 + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
520 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
521 - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
525 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
526 * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
530 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
531 / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
535 ~aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e
536 | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
540 ~aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e
541 | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h
542 ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
548 - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
549 | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
551 << aaaaaaaaaaaaaaaa.k
552 >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
556 # standalone comment at ENDMARKER