On 1/26/11 12:26 PM, sl33k_ wrote:
> How does "return True" and "return False" affect the execution of the
> calling function?
It doesn't -- the value 'True' or 'False' is simply returned, and
assigned to a name if the calling function does so explicitly. But
there's no built in affects. If you want it to alter the execution, you
have to do so yourself, i.e.:
def myfun():
return True
def myfun2():
return False
if myfun():
print "Something is true!"
myfun2()
print "I'm called. Cuz, the return value of myfun2 was simply discarded."
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog:
http://meh.ixokai.io/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
iQEcBAEBAgAGBQJNQJMcAAoJEKcbwptVWx/lVDUH/3TGyob9QXqjWhr2NWUouB6+
hcKlnUVv4yUq99cRQd6oFFwhnN7l7UvAiLibs7TwwV1Llar+4m hH6ktzIJlV7/wy
7C8PxpNwhGj8orj6QaMPt2Ex4biwBcoWqUT/A3uPCzhgvFtscX94LGOUwxKrKU3g
N7jxV9eSt1o9NUUai2Ol7vgk3hYc4iK0yHvjFEnAoaX0x+owTm 7YaQTs4Y8K0GSk
3zFuD1v6Ci+SCLu0NnOeWwCQgqdOmC9+qROHxaepl8BSA23APt N2lUYbJKQlaSOP
7Nl+vLonvQiRr14+AtYSCq2hptTu8U9iy7UX930bQp5DeqcTy+ rN3GWWLYkrI2Q=
=9ict
-----END PGP SIGNATURE-----