Swift’s string manipulation is one of its biggest misses. It focuses on Unicode clarity at a cost of what programmers actually need it to do. Converted this random Swift script to Python and its readability spiked.

Before:

let bold = "\u{001B}[1m"
let reset = "\u{001B}[0m"

for character in CommandLine.arguments[1...].map({ $0.uppercased() }).joined(separator: " ") {
    if let transform = map[character] {
        let firstCharacter = String(transform.first!)
        let remaining = transform[transform.index(after: transform.startIndex)...]
        print(bold + firstCharacter + reset + remaining)
    } else {
        print(character)
    }
}

After:

bold = "\033[1m"
reset = "\033[0m"

for character in " ".join(sys.argv[1:]).upper():
    if transform := map.get(character):
        print(bold + transform[0] + reset + transform[1:])
    else:
        print(character)