Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-19 Thread Simon Brunning
On 9/19/06, Magnus Lycka <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > this article > > > > http://effbot.org/zone/python-objects.htm > > > > may be useful for those who haven't already seen it. > > I don't know how many times I've referred to, or paraphrased, > that article. Shouldn't

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-19 Thread GHUM
Magnus Lycka schrieb: > > http://effbot.org/zone/python-objects.htm > > may be useful for those who haven't already seen it. > >Shouldn't it be incorporated into the standard tutorial? >I think it's very helpful for people who are used > to the way C etc handles variables. That would also be

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-19 Thread Magnus Lycka
Fredrik Lundh wrote: > this article > > http://effbot.org/zone/python-objects.htm > > may be useful for those who haven't already seen it. I don't know how many times I've referred to, or paraphrased, that article. Shouldn't it be incorporated into the standard tutorial? I think it's very he

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-14 Thread Bruno Desthuilliers
John Henry wrote: > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > >...some_huge_list is a huge list... >some_huge_list[0]=1 >aref = some_huge_list >aref[0]=0 >pri

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-14 Thread Christophe
John Henry a écrit : > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > >...some_huge_list is a huge list... >some_huge_list[0]=1 >aref = some_huge_list >aref[0]=0 >

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-14 Thread Fredrik Lundh
Dennis Lee Bieber wrote: > References to lists, dictionaries, and class instances (which are, > in a way, just an expanded dictionary) are "mutable" careful: it's not the *reference* that's mutable, it's the object. the *only* difference between mutable and immutable objects is that the la

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread George Sakkis
Grant Edwards wrote: > On 2006-09-13, John Henry <[EMAIL PROTECTED]> wrote: > > So, if I understand you correctly, I must make the reference > > to a more elaborate representation. Like: > > > >i=[1,] > >j=i > >j[0]=2 > >print i > > > > in order to get 2 printed. > > > > Correct?

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
Thanks for the reply, Grant. I am not doing things like that - I am just trying to clear up in my mind the Python concepts. I understand it now. Grant Edwards wrote: > On 2006-09-13, John Henry <[EMAIL PROTECTED]> wrote: > > Thanks for the reply, both to Laszlo and Steve. > > > > Okay, I under

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread Grant Edwards
On 2006-09-13, John Henry <[EMAIL PROTECTED]> wrote: > Thanks for the reply, both to Laszlo and Steve. > > Okay, I understand what you're saying. > > But what if I need to make a "pointer" to a simple variable. There's no such thing as a "simple variable". There are mutable objects and immutable

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
Thanks for the reply, both to Laszlo and Steve. Okay, I understand what you're saying. But what if I need to make a "pointer" to a simple variable. For instance, in C: int i=1 int *j=&i *j = 2 print i and you get 2 printed. In Python, i=1 j=i j=2 print i and you get

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread Steve Holden
John Henry wrote: > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > >...some_huge_list is a huge list... >some_huge_list[0]=1 >aref = some_huge_list >aref[0]=0 >pri

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread Laszlo Nagy
John Henry írta: > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > >...some_huge_list is a huge list... >some_huge_list[0]=1 >aref = some_huge_list >aref[0]=0 >print so

When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
Hi list, Just to make sure I understand this. Since there is no "pointer" type in Python, I like to know how I do that. For instance, if I do: ...some_huge_list is a huge list... some_huge_list[0]=1 aref = some_huge_list aref[0]=0 print some_huge_list[0] we know that the answere