Elektrine lite

โ† Feed

@pathunstrom@ngmx.com

Post #1793934

2026-04-29 01:53 UTC

Did a few minutes of poking at my little markdown word counter, and the voice of @treyhunner came to me and got me to change the output print statement from: ``` print(f"Total: {sum(result.count for result in results)}\n\t{"\n\t".join(f"{fc.file}: {fc.count}" for fc in results)}") ``` to ``` print(f"Total: {sum(result.count for result in results)}", *(f"{fc.file}: {fc.count}" for fc in results), sep="\n\t") ``` It's gnarly either way, but at least I don't have a bunch of "\n\t" in the middle anymore. EDIT: Okay, and it also doesn't have nested F-strings anymore. Very cool feature, but wow does it make parsing a line harder.

Replies (1)