scope of variables

Ben Finney bignose+hates-spam at benfinney.id.au
Thu May 4 00:07:14 CEST 2006


Gary Wessle <phddas at yahoo.com> 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
question.

-- 
 \     "[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