Strange return behavior for function

Robert Dailey rcdailey at gmail.com
Tue Aug 5 11:05:37 EDT 2008


Hi,

I've created a function to normalize Subversion URLs, however when I return
a string, printing the result of the function becomes "None". When I print
the value of the string before I return from the function, I see a valid
string. What's going on? The function is below:


def normurl( url_root, url ):
    mutableurl = url[len(url_root):]

    split1 = mutableurl.split( "..", 1 )
    if len(split1) == 1:
        print "Returning:", split1[0]
        return split1[0]

    split2 = split1[0][:-1].rsplit( "/", 1 )
    combined = split2[0] + split1[1]
    normurl( url_root, url_root + combined )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080805/2dae89b4/attachment.html>


More information about the Python-list mailing list