Python Gotcha: strip, lstrip, rstrip can remove more than expected(andrewwegner.com)
andrewwegner.com
Python Gotcha: strip, lstrip, rstrip can remove more than expected
https://andrewwegner.com/python-gotcha-strip-functions-unexpected-behavior.html
6 comments
This isn't a "gotcha". This is using the wrong function. "rstrip" and "removesuffix" are simply not the same thing.
Absolutely, it’s possible the name could be misleading but surely this is one of those times where maybe you make the mistake once and then never again. There are far more painful gotchas in Python (see mutable args).
Developer uses the wrong api and goes :surprised_pikachu:
RTFM