Re: function in a function accessing vars

2007-06-06 Thread Dustan
On Jun 6, 6:40 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi Diez, > > Thanks, I thought it worked similar to C++ where a higher compound > could access a lower section. It can 'access a lower section'; what it can't do is *change* that 'lower section'; in your example case with an int, this

Re: function in a function accessing vars

2007-06-06 Thread Jorgen Bodde
Hi Diez, Thanks, I thought it worked similar to C++ where a higher compound could access a lower section. But as it is not straight forward, I think it is better to embed the functionality inside a class, and make it a member variable .. now why didn't I think of that ;-) Thanks, - Jorgen On 6/6

Re: function in a function accessing vars

2007-06-06 Thread Diez B. Roggisch
Jorgen Bodde wrote: > Hi all, > > I wanted to solve a small problem, and I have a function that is > typically meant only as a function belonging inside another function. >>From the inner function I want to access a variable from the outer > function like; > > def A(): > some_var = 1 > def B

function in a function accessing vars

2007-06-06 Thread Jorgen Bodde
Hi all, I wanted to solve a small problem, and I have a function that is typically meant only as a function belonging inside another function. >From the inner function I want to access a variable from the outer function like; def A(): some_var = 1 def B(): some_var += 1 B() But this