Message193289
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. |
|
Date |
User |
Action |
Args |
2013-07-18 13:05:15 | ezio.melotti | set | recipients:
+ ezio.melotti, gvanrossum, mrabarnett |
2013-07-18 13:05:15 | ezio.melotti | set | messageid: <1374152715.43.0.84616492973.issue18468@psf.upfronthosting.co.za> |
2013-07-18 13:05:15 | ezio.melotti | link | issue18468 messages |
2013-07-18 13:05:14 | ezio.melotti | create | |
|