Why no string return?
Frank Millman
frank at chagford.com
Wed Mar 12 01:10:54 EDT 2008
gargonx wrote:
> Say i have the two methods:
>
> def ReturnMethod(request, x):
> if request is True:
> return x
> else: print "No String for you...False!"
>
> def SendMethod(request):
> xstring = "Some text"
> ReturnMethod(request, xstring)
>
> SendMethod(True)
>
> Why does ReturnMethod not return the string x? I do believe it is
> returning with a NoneType.
> Any help would be greatly obliged
>
> Thanks, Josh
ReturnMethod() is executed, but you do nothing with the result.
Try one of the following -
def SendMethod(request):
xstring = "Some text"
print ReturnMethod(request, xstring)
def SendMethod(request):
xstring = "Some text"
return ReturnMethod(request, xstring)
HTH
Frank Millman
More information about the Python-list
mailing list