Ezio Melotti added the comment:

I'm not sure it's worth changing it.
As I see it, match/search are supposed to work with str or bytes and they 
return str/bytes accordingly.  The fact that they work with other bytes-like 
objects seems to me an undocumented implementation detail people should not 
rely on.
If they are passing bytes-like object, both the current behavior (return same 
type) or the new proposed behavior (always return bytes) seem reasonable 
expectations.

IIUC the advantage of changing the behavior is that it won't keep the target 
string alive anymore, but on the other hand is not backward compatible and 
makes things more difficult for people who want the same type back.
If people always want bytes back regardless of the input, they can convert the 
input or output to bytes explicitly.

----------
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18468>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to