[Python-Dev] Misc re.match() complaint

Guido van Rossum guido at python.org
Tue Jul 16 04:23:55 CEST 2013


On Mon, Jul 15, 2013 at 7:18 PM, MRAB <python at mrabarnett.plus.com> wrote:
> On the other hand, I think that it's not unreasonable that the output
> is the same type as the input. You could reason that what it's doing is
> returning a slice of the input, and that slice should be the same type
> as its source.

By now I'm pretty sure that is why it changed.

But I am challenging how useful that is, compared to always returning
something immutable.

> Incidentally, the regex module does what Python 3's re module currently
> does, even in Python 2. Nobody's complained!

Well, you'd only see complaints from folks who (a) use the regex
module, (b) use it with a buffer object as the target string, and (c)
try to use the group() return value as a dict key. Each of these is
probably a small majority of all users.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list