Bruno Desthuilliers wrote:
2/ functional solution:
---
def make_funcs():
x = 0
def _abc():
x = 1
return x + 1
def _abcd():
return x + 1
return _abc, _abcd
abc, abcd = make_funcs()
print abc()
print abcd()
The x in
Peter Otten wrote:
Bruno Desthuilliers wrote:
2/ functional solution:
---
def make_funcs():
x = 0
def _abc():
x = 1
return x + 1
def _abcd():
return x + 1
return _abc, _abcd
abc, abcd = make_funcs()
print abc()
print abcd()
The
Ivan Shevanski wrote:
Thanks for your quick responce Roy, thats exactly what I needed. =)
No, it isn't! ;)
It might seem like a good idea right now, but it's not
a good choice in the long run. It's like peeing in bed:
Initially it's both a relief and you get warm and cosy,
but you'll end upp
Thanks for your quick responce Roy, thats exactly what I needed. =)
-Ivan
_
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
--
Ivan Shevanski a écrit :
Alright heres my problem. . .Say I want to carry over a variable from
one function to another or even another run of the same function. Is
that possible? Heres a quick example of what I'm talking about.
def abc():
x = 1
y = x + 1
print y
def abcd():
Alright heres my problem. . .Say I want to carry over a variable from one
function to another or even another run of the same function. Is that
possible? Heres a quick example of what I'm talking about.
def abc():
x = 1
y = x + 1
print y
def abcd():
y = x + 1
print y
abc()
Ivan Shevanski [EMAIL PROTECTED] wrote:
Alright heres my problem. . .Say I want to carry over a variable from one
function to another or even another run of the same function. Is that
possible?
You want one of two things.
The most obvious would be a global variable. Something like this: