Re: [Tutor] two ways

2005-11-11 Thread Shi Mu
thanks! On 11/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Liam Clarke schrieb: > > >Hi Shi, > > > >For what you're doing, nothing at all. > > > >When you use a colon, slice syntax, it defaults to [start:end] so p = > >a[:] is the same as > >p = a[0:len(a)] > > > > > > > But in fact there is a

Re: [Tutor] two ways

2005-11-11 Thread Alan Gauld
> what is the difference between the two ways of assigning the list? > p=a vs. p=a[:] The first makes p point at the same list as a. The second makes p point at a *copy* of the list pointed to by a. You will see the difference if you try to modify the lists after assignment. In the first case mod

Re: [Tutor] two ways

2005-11-11 Thread Liam Clarke
Oooh... that's a gotcha. Shi Mu - did you understand that? There is a crucial difference as Gregor pointed out, that I missed, and I do apologise. On 11/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Liam Clarke schrieb: > > >Hi Shi, > > > >For what you're doing, nothing at all. > > > >When you

Re: [Tutor] two ways

2005-11-11 Thread Gregor Lingl
Liam Clarke schrieb: >Hi Shi, > >For what you're doing, nothing at all. > >When you use a colon, slice syntax, it defaults to [start:end] so p = >a[:] is the same as >p = a[0:len(a)] > > > But in fact there is a difference. I'll show you: >>> a=range(5)### creates a list-object >>> id(a)

Re: [Tutor] two ways

2005-11-11 Thread Liam Clarke
Hi Shi, For what you're doing, nothing at all. When you use a colon, slice syntax, it defaults to [start:end] so p = a[:] is the same as p = a[0:len(a)] Regards, Liam Clarke On 11/11/05, Shi Mu <[EMAIL PROTECTED]> wrote: > what is the difference between the two ways of assigning the list? > p=

Re: [Tutor] two ways

2005-11-10 Thread Shi Mu
thanks! On 11/10/05, Liam Clarke <[EMAIL PROTECTED]> wrote: > Hi Shi, > > For what you're doing, nothing at all. > > When you use a colon, slice syntax, it defaults to [start:end] so p = > a[:] is the same as > p = a[0:len(a)] > > Regards, > > Liam Clarke > > On 11/11/05, Shi Mu <[EMAIL PROTECTED]