[Python-ideas] Give regex operations more sugar

Michel Desmoulin desmoulinmichel at gmail.com
Wed Jun 13 16:59:34 EDT 2018


> 
> Both accept a tuple. For example:
> 
>    >>> "foo".startswith(("f", "b"))
>    True
>    >>> "bar".startswith(("f", "b"))
>    True
> 

Nice. Now let's do that for str.replace.

>> Also, we do have to saturate the str namespace with all the re
>> functions. We could decide to go for `str.re.stuff`.
> 
> Attaching an entire module to a type is probably worse than
> adding a slew of extra methods to the type.
> 

Not my point.

str.re would not be the re module, just a namespace where to group all
regex related string methods.


More information about the Python-ideas mailing list