scope of variables

Marc 'BlackJack' Rintsch bj_666 at
Wed May 3 17:17:06 EDT 2006

In <874q06bz4c.fsf at localhost.localdomain>, Gary Wessle wrote:

> is the code below correct?


> b = 3
> def adding(a)

...a colon is missing at the end of the above line.

>     print a + b
> it seams not to see the up-level scope where b is defined.

It does.  And you could easily find out yourself by just trying that code.
 Running this::

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


Puts out 8 as expected.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list