# Python's raw strings have a hilarious bug

Original title: Python string literals are kinda funny

> Hacker News story 49192556 · language: en · submitted 2026-08-06
> Web version: https://zeli.app/story/49192556
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 61 · by [jandeboevrie](<https://news.ycombinator.com/user?id=jandeboevrie>) · 💬 60
[original](<https://sebsite.pw/w/20260806-pystrings.html>) · [HN discussion](<https://news.ycombinator.com/item?id=49192556>)

## Summary

A pop quiz reveals that Python's raw string literals can't end in a backslash, even though the backslash isn't actually escaping the quote. The author finds this funny because implementing f-strings requires a full Python parser, making the raw string limitation seem unnecessary. The post also notes that lambda and assignment expressions must be parenthesized inside f-strings.

## Key quote

> the fact that the expression can be terminated by : means that lambda expressions and assignment expressions must be parenthesized inside of f-strings, which is kinda funny i think

## HN discussion (60 comments)

### [PyWoody](<https://news.ycombinator.com/item?id=49225677>)

> Whenever I read people's takes about Python on HN, I always feel like I'm using an entirely different language.

### [dwdz](<https://news.ycombinator.com/item?id=49225133>)

> I'm not a fan of f-strings.
>
> I feel like 90% of new Python features in the last 10 years just increased language complexity without any benefit.

### [phyzome](<https://news.ycombinator.com/item?id=49225508>)

> Goofy edge cases aside, I think f-strings are great.

### [vova_hn2](<https://news.ycombinator.com/item?id=49225971>)

> I think this is pretty intuitive (I was able to answer the question correctly before opening the spoiler), but I really like raw string designs in Rust and C++11 that allow you to stop worrying about escaping completely.

### [ethin](<https://news.ycombinator.com/item?id=49225908>)

> Not really about the content of the blog post but am I the only one bothered by the complete lack of capitalization? Granted it may be because of my screen reader but my TTS engine of choice doesn't pause on un-capitalized words/sentences/phrases/etc. which follow a full stop, so this post unless I read it line by line (minus the code) just blends into complete noise.

---

## Cite

- Page: https://zeli.app/story/49192556
- Date: 2026-08-06
- Source: sebsite.pw (https://sebsite.pw/w/20260806-pystrings.html)
- Hacker News: https://news.ycombinator.com/item?id=49192556

## Other languages

- zh: https://zeli.app/zh/story/49192556 · markdown: https://zeli.app/zh/story/49192556.md
- ja: https://zeli.app/ja/story/49192556 · markdown: https://zeli.app/ja/story/49192556.md
- ko: https://zeli.app/ko/story/49192556 · markdown: https://zeli.app/ko/story/49192556.md
- de: https://zeli.app/de/story/49192556 · markdown: https://zeli.app/de/story/49192556.md
- es: https://zeli.app/es/story/49192556 · markdown: https://zeli.app/es/story/49192556.md
