references ???

Joonas Paalasmaa joonas at olen.to
Thu Nov 1 12:35:06 EST 2001


Emile van Sebille wrote:
> 
> "Thomas Weidner" <wolf359_ at gmx.net> wrote in message
> news:pan.2001.11.01.17.30.27.280.2271 at gmx.net...
> > Hi,
> >
> > I think anybody here knows what references,like in java,c++ or perl, are.
> > How can i use references in python ?
> >
> > 2.Question:
> > l=[1,2,3,4,5,6]
> > for i in l:i=0
> > print l
> >
> > l is still [1,2,3,4,5,6]. How to make changes made to i also apply to l ?
> 
> for i in len(l):
>     l[i] = 0

Shouldn't that be 

for i in range(len(l)):
    l[i] = 0



More information about the Python-list mailing list