4 Feb
2014
4 Feb
'14
4:15 p.m.
Here is something that always annoys me. I was going to write my own rreplace function, like this: def rreplace(s, old, new, count=None): return new.join(s.rsplit(old, count)) But lo and behold, I have to write it like this: def rreplace(s, old, new, count=None): return new.join(s.rsplit(old, count) if count is not None else s.rsplit(old)) Why? Because the `str.rsplit` can't handle a count of `None`. That is quite annoying. There are many more builtin functions except `str.rsplit` that behave like this. What do you think about going over all such functions and making them able to accept `None`? Thanks, Ram.