Python Gotcha: strip, lstrip, rstrip can remove more than expected (andrewwegner.com) 13 points by synergy20 2y ago ↗ HN
[–] LeoPanthera 2y ago ↗ This isn't a "gotcha". This is using the wrong function. "rstrip" and "removesuffix" are simply not the same thing. [–] duke_sam 2y ago ↗ 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).
[–] duke_sam 2y ago ↗ 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).
6 comments
[ 3.3 ms ] story [ 35.4 ms ] thread