Strange return behavior for function
Robert Dailey
rcdailey at gmail.com
Tue Aug 5 11:07:03 EDT 2008
On Tue, Aug 5, 2008 at 10:05 AM, Robert Dailey <rcdailey at gmail.com> wrote:
> 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 )
>
Bah, never mind. I just figured it out. I needed a 'return' before my
recursive normurl() call. Sorry for the wasted post!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080805/c79eed4f/attachment-0001.html>
More information about the Python-list
mailing list