Jeff Abrahamson on 4 Oct 2004 16:51:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] python and global name space


On Mon, Oct 04, 2004 at 10:59:32AM -0400, Walt Mankowski wrote:
>   [52 lines, 251 words, 1422 characters]  Top characters: noea\nirl
> 
> On Mon, Oct 04, 2004 at 10:35:34AM -0400, Jeff Abrahamson wrote:
> > In a python program I want to have a global counter that's available
> > from different functions.
> > [...]
> 
> You have to declare num as global in the *function*, not in the outer
> scope.  So this works:

Thanks Walt, Dan, and Paul.  That was what I was missing.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

 A cool book of games, highly worth checking out:
 http://www.amazon.com/exec/obidos/ASIN/1931686963/purple-20

Attachment: signature.asc
Description: Digital signature