Re: Weird local variables behaviors

2008-06-21 Thread Sebastjan Trepca
I see, intuitively one would think it would try to get it from global context as it's not yet bound in the local. Thanks for the explanation. Sebastjan On Sat, Jun 21, 2008 at 5:48 AM, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Jun 20, 7:32 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote: >> Sebast

Re: Weird local variables behaviors

2008-06-20 Thread Dan Bishop
On Jun 20, 7:32 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Sebastjan Trepca wrote: > > Hey, > > > can someone please explain this behavior: > > > The code: > > > def test1(value=1): > >     def inner(): > >         print value > >     inner() > > > def test2(value=2): > >     def inner(): > >  

Re: Weird local variables behaviors

2008-06-20 Thread Matt Nordhoff
Sebastjan Trepca wrote: > Hey, > > can someone please explain this behavior: > > The code: > > def test1(value=1): > def inner(): > print value > inner() > > > def test2(value=2): > def inner(): > value = value > inner() > > test1() > test2() > > [EMAIL PROTEC

Weird local variables behaviors

2008-06-20 Thread Sebastjan Trepca
Hey, can someone please explain this behavior: The code: def test1(value=1): def inner(): print value inner() def test2(value=2): def inner(): value = value inner() test1() test2() [EMAIL PROTECTED] ~/dev/tests]$ python locals.py 1 Traceback (most recent call