Elektrine lite

← Feed

@tmr232@mastodon.social

Post #2753040

2024-02-08 10:37 UTC

@ambv@mastodon.social listening as I'm writing this... I was looking forward to the mention of backslash at the end of raw strings, and you brought it up, but I still don't understand why it isn't allowed. After all - they don't escape anything in raw strings.

Replies (1)

  • @ambv@mastodon.social 2024-02-08 16:16

    @tmr232@mastodon.social The backslash DOES escape the closing quote in raw strings. That's why this behavior is preserved all the way to the last character in a string. >>> print(r"A\"B") A"B Sure, it's a bit unexpected, and actively annoying for Windows paths. But it's weirdly consistent.

    Open ##2753041