Why no string return?

Piet van Oostrum piet at cs.uu.nl
Wed Mar 12 09:55:53 EDT 2008


>>>>> gargonx <gargonx at gmail.com> (g) wrote:

>g> Still no return of string. The null testing is not really the deal.
>g> that could be replaced with anything EG:

>g> def ReturnMethod(request, x):
>g>     if request is 'random':

You shouldn't test with `is' but with `=='.

>g>             return x
>g>     else: print "No String for you...False!"

>g> def SendMethod(request):
>g>     xstring = "Some text"
>g>     ReturnMethod(request, xstring)

>g> SendMethod('random')

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list