Raymond Hettinger <python at rcn.com> wrote: > They include [...] the str.partition function, Where is the current version of this patch? After reharsing the archives, I have an additional suggestion which I didn't find already mentioned in the discussion. What about: str.partition() -> (left, right or None) str.rparition() -> (left or None, right) which means: "foo:bar".partition(":") -> ("foo", "bar") "foo:bar".rpartition(":") -> ("foo", "bar") "foo:".partition(":") -> ("foo", "") "foo:".rpartition(":") -> ("foo", "") ":foo".partition(":") -> ("", "foo") ":foo".rpartition(":") -> ("", "foo") "foo".partition(":") -> ("foo", None) "foo".rpartition(":") -> (None, "foo") Notice that None-checking can be done as a way to know if the separator was found. I mentally went through the diff here (http://mail.python.org/pipermail/python-dev/2005-August/055781.html) and found out that most (all?) the usages of '_' disappears with this semantic. -- Giovanni Bajo
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4