Re: Carrying variables over from function to function

2005-09-27 Thread Magnus Lycka
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 wi

Re: Carrying variables over from function to function

2005-09-27 Thread bruno modulix
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

Re: Carrying variables over from function to function

2005-09-27 Thread Peter Otten
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

Re: Carrying variables over from function to function

2005-09-26 Thread Bruno Desthuilliers
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

Re: Carrying variables over from function to function

2005-09-26 Thread Ivan Shevanski
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 -- http://mai

Re: Carrying variables over from function to function

2005-09-25 Thread Roy Smith
"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 th

Carrying variables over from function to function

2005-09-25 Thread Ivan Shevanski
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() abcd