Re: behavior difference for mutable and immutable variable in function definition

2007-05-05 Thread jianbing . chen
On May 4, 5:14 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-05-04 at 14:30 -0700, [EMAIL PROTECTED] wrote: > > Hi, > > > Can anyone explain the following: > > > Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) > > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > > Type "help", "copyri

Re: behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread Roger Miller
On May 4, 12:39 pm, 7stud <[EMAIL PROTECTED]> wrote: > On May 4, 3:30 pm, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > Can anyone explain the following: > > > Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) > > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > > Type "help", "copyright", "credits" o

Re: behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread 7stud
On May 4, 3:30 pm, [EMAIL PROTECTED] wrote: > Hi, > > Can anyone explain the following: > > Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> def > foo(): > > ... x = 2 >

Re: behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread Carsten Haese
On Fri, 2007-05-04 at 14:30 -0700, [EMAIL PROTECTED] wrote: > Hi, > > Can anyone explain the following: > > Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> def foo(): >

Re: behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi, > > Can anyone explain the following: > > Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > def foo(): > > ... x = 2 > ... > foo(

behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread jianbing . chen
Hi, Can anyone explain the following: Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def foo(): ... x = 2 ... >>> foo() >>> def bar(): ... x[2] = 2 ... >>> >>> bar()