Why Don't Return?
Victor Subervi
victorsubervi at gmail.com
Wed Dec 5 09:07:44 EST 2007
Thanks :)
On Dec 3, 2007 6:58 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>
> "Victor Subervi" <victorsubervi at gmail.com> wrote in message
> news:4dc0cfea0712031205t1a6bb511vd8744015d6ff2660 at mail.gmail.com...
> | def a():
> | b()
>
> Here is the error: should be
> c = b()
>
> | print c
> |
> | def b():
> | c = "Hi"
> | return c
> |
> | if __name__ == "__main__":
> | a()
> |
> | then run a(). Throws error about c not being defined. How do I return c
> from
> | b?
>
> You did, but you did not 'catch' it within a(). See above for change.
>
> tjr
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071205/5425bc3a/attachment.html>
More information about the Python-list
mailing list