Re: [Tutor] global list

2014-04-24 Thread Steven D'Aprano
On Thu, Apr 24, 2014 at 01:14:33AM -0700, Albert-Jan Roskam wrote: > - Original Message - > > From: Steven D'Aprano > > To: tutor@python.org > > Cc: > > Sent: Thursday, April 24, 2014 3:00 AM > > Subject: Re: [Tutor] global list > > >

Re: [Tutor] global list

2014-04-24 Thread Albert-Jan Roskam
> From: Peter Otten <__pete...@web.de> >To: tutor@python.org >Sent: Thursday, April 24, 2014 1:49 PM >Subject: Re: [Tutor] global list > > >Albert-Jan Roskam wrote: >> - Original Message - >>> From: Steven

Re: [Tutor] global list

2014-04-24 Thread Peter Otten
Albert-Jan Roskam wrote: > > > > > > - Original Message - >> From: Steven D'Aprano >> To: tutor@python.org >> Cc: >> Sent: Thursday, April 24, 2014 3:00 AM >> Subject: Re: [Tutor] global list >> > > >

Re: [Tutor] global list

2014-04-24 Thread Gerardo Juárez
On 04/23/2014 06:46 PM, Denis Heidtmann wrote: In a coursera python course video the following code was presented: a = [4,5,6] def mutate_part(x): a[1] = x mutate_part(200) The presenter said something like "a is a global variable, so a becomes [4,200,6] after running mutate_part(200)."

Re: [Tutor] global list

2014-04-24 Thread Mark Lawrence
On 24/04/2014 09:23, Danny Yoo wrote: Should have no runtime performance difference. For similar reasons, using a very long variable name does not change a program's runtime performance. Please quote some context, this is meaningless without it, thanks. -- My fellow Pythonistas, ask not wha

Re: [Tutor] global list

2014-04-24 Thread Danny Yoo
Should have no runtime performance difference. For similar reasons, using a very long variable name does not change a program's runtime performance. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyth

Re: [Tutor] global list

2014-04-24 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Thursday, April 24, 2014 3:00 AM > Subject: Re: [Tutor] global list > > You only need to define variables as global if you assign to them: > > def function(x): >

Re: [Tutor] global list

2014-04-23 Thread Steven D'Aprano
On Wed, Apr 23, 2014 at 04:46:49PM -0700, Denis Heidtmann wrote: > In a coursera python course video the following code was presented: > > a = [4,5,6] > > def mutate_part(x): > a[1] = x > > mutate_part(200) > > The presenter said something like "a is a global variable, so a becomes > > [4,

[Tutor] global list

2014-04-23 Thread Denis Heidtmann
In a coursera python course video the following code was presented: a = [4,5,6] def mutate_part(x): a[1] = x mutate_part(200) The presenter said something like "a is a global variable, so a becomes [4,200,6] after running mutate_part(200)." Indeed it does, but why does this work without s