GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    neoluddite (neoluddite@aus.social)'s status on Tuesday, 23-Dec-2025 14:43:11 JSTneoludditeneoluddite
    • Deborah Pickett

    @futzle Walrus operators in Python are pretty weird, and everybody loves generator expressions, right?:

    data = [
    ("first", "a", "partridge in a pear tree"),
    ("second", "Two", "turtle doves"),
    ("third", "Three", "french hens"),
    ("fourth", "Four", "calling birds"),
    ("fifth", "Five", "golden rings"),
    ("sixth", "Six", "geese a-laying"),
    ("seventh", "Seven", "swans a-swimming"),
    ("eighth", "Eight", "maids a-milking"),
    ("ninth", "Nine", "ladies dancing"),
    ("tenth", "Ten", "lords a-leaping"),
    ("eleventh", "Eleven", "pipers piping"),
    ("twelfth", "Twelve", "drummers drumming"),
    ]
    for x in (
    gift_list := f"On the {ith} day of Christmas, my true love gave to me\n" + f"{count} {gift}\n" + ("" if ith == "first" else "And " + gift_list.split("\n")[-2] + "\n" if ith == "second" else '\n'.join(gift_list.split("\n")[1:]))
    for ith, count, gift in data
    ):
    print(x)

    In conversationabout 7 months ago from aus.socialpermalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.