s.startswith(unicode) bug???

Roger roger at efn.org
Thu Oct 3 01:15:16 EDT 2002


Around Wed,Oct 02 2002, at 10:02,  Erik Westra, wrote:
> Hi,
> 
> I'm running Python 2.2 (not 2.2.1) under Windows 2K, and have come
> across the following bug.  I was wondering if someone with 2.2.1 could
> please check if it still happens -- if so, I'll post a bug report to
> the Python SourceForce site.
> 
> Under Python 2.2, if I evaluate:
> 
>     "a".startswith("a")
> 
> it correctly returns 1.  But if I change the substring to unicode,
> like this:
> 
>     "a".startswith(u"a")
> 
> it returns 0!  If I then try:
> 
>     "ab".startswith(u"a")
> 
> it again returns 1.  Most weird!  This only happens with the substring
> is in unicode rather than a normal string...
> 

And,
"a".startswith(u"")
returns 1 
on my 2.2 system.

Actually, any number of characters in the string "abc.."[1] returns a 1 
with both (u"") and (u"a").


Roger
[1] I didn't have time to check every number combination of characters, 
just tried 'ab' and 'abcd', I was just assuming the 'any number' bit :^)




More information about the Python-list mailing list