What am I doing wrong here?

Gerhard Häring gh at ghaering.de
Sun Jun 29 23:22:04 EDT 2003


Bill C. Wong wrote:
> ################################
> def func( s ):
>     s1, s2 = s.split( ' ', 1 )
>     try:
>         raise s1
>     except "aaaa":
>         print 'except "aaaa"'
>     except:
>         print 'except:'
> 
> s = "aaaa "
> func( s )
> ################################
> If I manually assign s1 with s1 = "aaaa", then it works fine! What am I
> doing wrong here?

This looks like a Python bug to me. The place to open Python bug reports 
is at Sourceforge. I've done so. Please let's continue the analasysis of 
this at 
http://sourceforge.net/tracker/index.php?func=detail&aid=762985&group_id=5470&atid=105470

I'll try to make more sense of this by looking at the C source code of 
the string methods.

-- Gerhard





More information about the Python-list mailing list