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]]]],
120 numpy[:, (0, 1, 2, 5)]
128 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
129 {'2.7': dead, '3.7': long_live or die_hard}
130 {'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
131 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
135 (i for i in (1, 2, 3))
136 ((i ** 2) for i in (1, 2, 3))
137 ((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
138 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
140 {"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
146 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
147 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
148 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()
150 authors.łukasz.say_thanks()
152 A: 0.25 * (10.0 / 12),
153 B: 0.1 * (10.0 / 12),
154 C: 0.1 * (10.0 / 12),
155 D: 0.1 * (10.0 / 12),
159 yield from outside_of_generator
163 await some.complicated[0].call(with_args=(True or (1 is not 1)))
165 print(**{1: 3} if False else {x: x for x in range(3)})
167 assert(not Test),("Short message")
168 assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
169 assert(((parens is TooMany)))
170 for x, in (1,), (2,), (3,): ...
172 for z in (i for i in (1, 2, 3)): ...
173 for i in (call()): ...
174 for j in (1 + (2 + 3)): ...
175 while(this and that): ...
176 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
177 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
178 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
179 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
181 threading.current_thread() != threading.main_thread() and
182 threading.current_thread() != threading.main_thread() or
183 signal.getsignal(signal.SIGINT) != signal.default_int_handler
187 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
188 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaa.d @ aaaaaaaaaaaaaaaa.e | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h ^ aaaaaaaaaaaaaaaa.i << aaaaaaaaaaaaaaaa.k >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
229 # standalone comment at ENDMARKER
246 True or False or None
248 True and False and None
249 (Name1 and Name2) or Name3
250 Name1 and Name2 or Name3
251 Name1 or (Name2 and Name3)
252 Name1 or Name2 and Name3
253 (Name1 and Name2) or (Name3 and Name4)
254 Name1 and Name2 or Name3 and Name4
255 Name1 or (Name2 and Name3) or Name4
256 Name1 or Name2 and Name3 or Name4
260 1 + v2 - v3 * 4 ^ 5 ** v6 / 7 // 8
261 ((1 + v2) - (v3 * 4)) ^ (((5 ** v6) / 7) // 8)
266 ~int and not v1 ^ 123 + v2 | True
267 (~int) and (not ((v1 ^ (123 + v2)) | True))
268 flags & ~select.EPOLLIN and waiters.write_task is not None
271 lambda a, b, c=True: a
272 lambda a, b, c=True, *, d=(1 << v2), e="str": a
273 lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
274 manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
275 foo = lambda port_id, ignore_missing: {
276 "port1": port1_resource,
277 "port2": port2_resource,
280 str or None if True else str or bytes or None
281 (str or None) if True else (str or bytes or None)
282 str or None if (1 if True else 2) else str or bytes or None
283 (str or None) if (1 if True else 2) else (str or bytes or None)
285 (super_long_variable_name or None)
286 if (1 if super_long_test_name else 2)
287 else (str or bytes or None)
289 {"2.7": dead, "3.7": (long_live or die_hard)}
290 {"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
292 {"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
293 ({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
299 [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
306 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
311 {i for i in (1, 2, 3)}
312 {(i ** 2) for i in (1, 2, 3)}
313 {(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
314 {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
315 [i for i in (1, 2, 3)]
316 [(i ** 2) for i in (1, 2, 3)]
317 [(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
318 [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
319 {i: 0 for i in (1, 2, 3)}
320 {i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
321 {a: b * 2 for a, b in dictionary.items()}
322 {a: b * -2 for a, b in dictionary.items()}
325 for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
327 Python3 > Python2 > COBOL
332 call(arg, kwarg="hey")
333 call(arg, another, kwarg="hey", **kwargs)
335 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
340 ) # note: no trailing comma pre-3.6
342 call(a, *gidgets[:2])
343 call(**self.screen_kwargs)
344 call(b, **self.screen_kwargs)
353 tuple[str, int, float, dict[str, int]]
354 very_long_variable_name_filters: t.List[
355 t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
375 numpy[:, (0, 1, 2, 5)]
383 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
384 {"2.7": dead, "3.7": long_live or die_hard}
385 {"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
386 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
390 (i for i in (1, 2, 3))
391 ((i ** 2) for i in (1, 2, 3))
392 ((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
393 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
399 "ended_at": now() + timedelta(days=10),
401 "import_session_id": 1,
409 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
412 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
416 session.query(models.Customer.id)
418 models.Customer.account_id == account_id, models.Customer.email == email_address
420 .order_by(models.Customer.id.asc())
424 authors.łukasz.say_thanks()
426 A: 0.25 * (10.0 / 12),
427 B: 0.1 * (10.0 / 12),
428 C: 0.1 * (10.0 / 12),
429 D: 0.1 * (10.0 / 12),
434 yield from outside_of_generator
439 await some.complicated[0].call(with_args=(True or (1 is not 1)))
443 print(**{1: 3} if False else {x: x for x in range(3)})
445 assert not Test, "Short message"
446 assert this is ComplexTest and not requirements.fit_in_a_single_line(
449 assert parens is TooMany
450 for (x,) in (1,), (2,), (3,):
454 for z in (i for i in (1, 2, 3)):
458 for j in 1 + (2 + 3):
463 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
464 in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
467 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
468 not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
471 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
472 is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
475 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
476 is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
479 threading.current_thread() != threading.main_thread()
480 and threading.current_thread() != threading.main_thread()
481 or signal.getsignal(signal.SIGINT) != signal.default_int_handler
485 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
486 | aaaaaaaaaaaaaaaaaaaaa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aa.e
529 | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
531 << aaaaaaaaaaaaaaaa.k
532 >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
536 # standalone comment at ENDMARKER