re.sub() bug?

holger krekel pyth at devel.trillke.net
Fri Nov 8 04:25:53 EST 2002
Mike Brown wrote:
> Python 2.2.1 on FreeBSD.
> These work as expected:
> 
> >>> re.sub(u'f', u'b', u'foo')  # keep string as Unicode
> u'boo'
> >>> re.sub(u'f', u'b', 'foo')   # coerce string to Unicode
> u'boo'
> 
> But this doesn't work the way I'd think it would:
> 
> >>> re.sub(u'f', u'b', u'')     # coerce string to non-Unicode?!
> ''
> 
> So, is this a bug?

I think so.  File a bug report at sourceforge.

    holger




More information about the Python-list mailing list