[Python-ideas] Give regex operations more sugar
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Jun 13 20:09:35 EDT 2018
Michel Desmoulin wrote:
> Also, we do have to saturate the str namespace with all the re
> functions. We could decide to go for `str.re.stuff`.
However, note that this is not as simple as just adding a
class attribute to str that references the re module,
since presumably you want to be able to write
mystring.re.match(pattern)
instead of having to write
mystring.re.match(pattern, mystring)
or
str.re.match(pattern, mystring)
which would mostly defeat the purpose.
--
Greg
More information about the Python-ideas
mailing list