File: commas.py

package info (click to toggle)
flake8-black 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 232 kB
  • sloc: python: 207; sh: 38; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Example of black and magic commas."""

vegetables = {
    "carrot",
    "parsnip",
    "potato",
    "swede",
    "leak",
    "aubergine",
    "tomato",
    "peas",
    "beans",
}

# This set would easily fit on one line, but a trailing comma
# after the final entry tells black (by default) to leave this
# with one entry per line:
yucky = {
    "aubergine",
    "squid",
    "snails",
}

print("I dislike these vegetables: %s." % ", ".join(vegetables.intersection(yucky)))