scope of variables

Ben Finney bignose+hates-spam at
Wed May 3 18:07:14 EDT 2006

Gary Wessle <phddas at> writes:

> is the code below correct?

It's best to post an example that you've tried yourself, and that is
small but completely demonstrates the issue in question.

> b = 3
> def adding(a)
>     print a + b

This, for example, would fail the syntax check (the 'def' statement
needs a trailing colon). After that's fixed, the code runs, but shows
no output.

A complete, minimal, working example will help people answer your

 \     "[W]e are still the first generation of users, and for all that |
  `\     we may have invented the net, we still don't really get it."  |
_o__)                                                 -- Douglas Adams |
Ben Finney

More information about the Python-list mailing list