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}
157 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
158 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
159 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()
161 authors.łukasz.say_thanks()
163 A: 0.25 * (10.0 / 12),
164 B: 0.1 * (10.0 / 12),
165 C: 0.1 * (10.0 / 12),
166 D: 0.1 * (10.0 / 12),
170 yield from outside_of_generator
176 await some.complicated[0].call(with_args=(True or (1 is not 1)))
178 print(**{1: 3} if False else {x: x for x in range(3)})
180 assert(not Test),("Short message")
181 assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
182 assert(((parens is TooMany)))
183 for x, in (1,), (2,), (3,): ...
185 for z in (i for i in (1, 2, 3)): ...
186 for i in (call()): ...
187 for j in (1 + (2 + 3)): ...
188 while(this and that): ...
189 for addr_family, addr_type, addr_proto, addr_canonname, addr_sockaddr in socket.getaddrinfo('google.com', 'http'):
191 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
192 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
193 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
194 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
196 threading.current_thread() != threading.main_thread() and
197 threading.current_thread() != threading.main_thread() or
198 signal.getsignal(signal.SIGINT) != signal.default_int_handler
202 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
203 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
207 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
208 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
212 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
213 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
217 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
218 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
222 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
223 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
227 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
228 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
232 ~ 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
236 ~ 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
240 ~ 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
244 # standalone comment at ENDMARKER
261 True or False or None
263 True and False and None
264 (Name1 and Name2) or Name3
265 Name1 and Name2 or Name3
266 Name1 or (Name2 and Name3)
267 Name1 or Name2 and Name3
268 (Name1 and Name2) or (Name3 and Name4)
269 Name1 and Name2 or Name3 and Name4
270 Name1 or (Name2 and Name3) or Name4
271 Name1 or Name2 and Name3 or Name4
275 1 + v2 - v3 * 4 ^ 5 ** v6 / 7 // 8
276 ((1 + v2) - (v3 * 4)) ^ (((5 ** v6) / 7) // 8)
281 ~int and not v1 ^ 123 + v2 | True
282 (~int) and (not ((v1 ^ (123 + v2)) | True))
283 flags & ~select.EPOLLIN and waiters.write_task is not None
286 lambda a, b, c=True: a
287 lambda a, b, c=True, *, d=(1 << v2), e="str": a
288 lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
289 manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
290 foo = lambda port_id, ignore_missing: {
291 "port1": port1_resource,
292 "port2": port2_resource,
295 str or None if True else str or bytes or None
296 (str or None) if True else (str or bytes or None)
297 str or None if (1 if True else 2) else str or bytes or None
298 (str or None) if (1 if True else 2) else (str or bytes or None)
300 (super_long_variable_name or None)
301 if (1 if super_long_test_name else 2)
302 else (str or bytes or None)
304 {"2.7": dead, "3.7": (long_live or die_hard)}
305 {"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
307 {"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
308 ({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
314 [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
321 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
326 {i for i in (1, 2, 3)}
327 {(i ** 2) for i in (1, 2, 3)}
328 {(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
329 {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
330 [i for i in (1, 2, 3)]
331 [(i ** 2) for i in (1, 2, 3)]
332 [(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
333 [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
334 {i: 0 for i in (1, 2, 3)}
335 {i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
336 {a: b * 2 for a, b in dictionary.items()}
337 {a: b * -2 for a, b in dictionary.items()}
340 for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
342 Python3 > Python2 > COBOL
347 call(arg, kwarg="hey")
348 call(arg, another, kwarg="hey", **kwargs)
350 this_is_a_very_long_variable_which_will_force_a_delimiter_split,
355 ) # note: no trailing comma pre-3.6
357 call(a, *gidgets[:2])
358 call(**self.screen_kwargs)
359 call(b, **self.screen_kwargs)
368 tuple[str, int, float, dict[str, int]]
369 very_long_variable_name_filters: t.List[
370 t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
372 xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
373 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
375 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
377 ] = classmethod( # type: ignore
378 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
380 xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(
381 sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
401 numpy[:, (0, 1, 2, 5)]
409 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
410 {"2.7": dead, "3.7": long_live or die_hard}
411 {"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
412 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
416 (i for i in (1, 2, 3))
417 ((i ** 2) for i in (1, 2, 3))
418 ((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
419 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
425 "ended_at": now() + timedelta(days=10),
427 "import_session_id": 1,
437 what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
440 what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
444 session.query(models.Customer.id)
446 models.Customer.account_id == account_id, models.Customer.email == email_address
448 .order_by(models.Customer.id.asc())
452 authors.łukasz.say_thanks()
454 A: 0.25 * (10.0 / 12),
455 B: 0.1 * (10.0 / 12),
456 C: 0.1 * (10.0 / 12),
457 D: 0.1 * (10.0 / 12),
462 yield from outside_of_generator
469 await some.complicated[0].call(with_args=(True or (1 is not 1)))
473 print(**{1: 3} if False else {x: x for x in range(3)})
475 assert not Test, "Short message"
476 assert this is ComplexTest and not requirements.fit_in_a_single_line(
479 assert parens is TooMany
480 for (x,) in (1,), (2,), (3,):
484 for z in (i for i in (1, 2, 3)):
488 for j in 1 + (2 + 3):
498 ) in socket.getaddrinfo("google.com", "http"):
501 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
502 in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
505 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
506 not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
509 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
510 is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
513 aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
514 is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
517 threading.current_thread() != threading.main_thread()
518 and threading.current_thread() != threading.main_thread()
519 or signal.getsignal(signal.SIGINT) != signal.default_int_handler
523 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
524 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
528 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
529 & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
533 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
534 + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
538 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
539 - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
543 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
544 * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
548 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
549 / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
553 ~aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e
554 | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
558 ~aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e
559 | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h
560 ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
566 - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
567 | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
569 << aaaaaaaaaaaaaaaa.k
570 >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
574 # standalone comment at ENDMARKER