On Sat, 14 Jul 2007 03:18:43 +0200, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
>Wayne Brehaut wrote:
>>> (had to be a semicolon there)
>>>
>>
>> Not "had to be" since a discerning reader will note that the two
>> values in the list:
>>
>> >>> id(x), id(y)
>> (19105872, 1909166
Chris Carlen <[EMAIL PROTECTED]> writes:
> Excellent description. This understandable to me since I can
> envision doing this with pointers.
It would be better if you thought in terms of "refrences". Python
names are unlike pointers in that they don't "store" anything. The
*only* thing to do wit
En Fri, 13 Jul 2007 13:41:39 -0300, Chris Carlen
<[EMAIL PROTECTED]> escribió:
> Ben Finney wrote:
>> Some languages have "variables", which act like boxes that have names
>> etched on the side. Once created, the box can contain an object, and
>> it can be inspected while in the box; to change t
Wayne Brehaut wrote:
>> (had to be a semicolon there)
>>
>
> Not "had to be" since a discerning reader will note that the two
> values in the list:
>
> >>> id(x), id(y)
> (19105872, 19091664)
Wll, as long as we are nitpicking: That's a tuple, not a list.
;)
/W
--
http://mail
Chris Carlen a écrit :
(snip)
>
> Excellent description. This understandable to me since I can envision
> doing this with pointers. But I have no idea how Python actually
> implements this.
The code source is freely available, and it's in C !-)
> It also appears that I am being guided away
Chris Mellon wrote:
> On 7/13/07, Chris Carlen <[EMAIL PROTECTED]> wrote:
>> Ben Finney wrote:
>>> Chris Carlen <[EMAIL PROTECTED]> writes:
>
>>> That's not how Python works. Every value is an object; the assignment
>>> operator binds a name to an object. This is more like writing the name
>>> on
On Fri, 13 Jul 2007 18:49:06 +0200, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
>Wildemar Wildenburger wrote:
>> x = [1, 2, 3]
>> y = [1, 2, 3]
>> id(x), id(y)
>> x == y
>> x is y
>>
>Ooops!
>
>Make that:
>
>x = [1, 2, 3]
>y = [1, 2, 3]
>id(x); id(y)
>x == y
>x is y
>
>(had to be a semicol
On 7/13/07, Chris Carlen <[EMAIL PROTECTED]> wrote:
> Ben Finney wrote:
> > Chris Carlen <[EMAIL PROTECTED]> writes:
> > That's not how Python works. Every value is an object; the assignment
> > operator binds a name to an object. This is more like writing the name
> > on a sticky-note, and sticki
Wildemar Wildenburger wrote:
> x = [1, 2, 3]
> y = [1, 2, 3]
> id(x), id(y)
> x == y
> x is y
>
Ooops!
Make that:
x = [1, 2, 3]
y = [1, 2, 3]
id(x); id(y)
x == y
x is y
(had to be a semicolon there)
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney wrote:
> Chris Carlen <[EMAIL PROTECTED]> writes:
>
> def change(some_list):
> some_list[1] = 4
>
> x = [1,2,3]
> change(x)
> print x # Prints out [1,4,3]
> ---
> def nochange(x):
> x = 0
>
> y = 1
> nochange(y)
> print y # Prints out 1
>
>>I don't understand Hetland's
Chris Carlen wrote:
> Let's go back the statement:
>
> x = [1,2,3]
>
> Do we then say: "[1,2,3] is x" or is it the other way around: "x is
> [1,2,3]" ???
>
This will yield 'False', because 'is' checks for *identity* not
equality. In your case you assign a list the name 'x' and then check
(via
Gabriel Genellina wrote:
> En Thu, 12 Jul 2007 21:51:08 -0300, Chris Carlen
> <[EMAIL PROTECTED]> escribió:
>> http://hetland.org/writing/instant-python.html
>> I don't understand Hetland's terminology though, when he is speaking of
>> "binding" and "reference." Actually, Hetland's entire first
Chris Carlen <[EMAIL PROTECTED]> writes:
> I don't understand Hetland's terminology though, when he is speaking
> of "binding" and "reference." Actually, Hetland's entire first
> paragraph is unclear.
>
> Can anyone reword this in a way that is understandable?
I've had some success with the foll
En Thu, 12 Jul 2007 21:51:08 -0300, Chris Carlen
<[EMAIL PROTECTED]> escribió:
> Hi:
>
> I have begun learning Python by experimenting with the code snippets
> here:
>
> http://hetland.org/writing/instant-python.html
>
> In the section on functions, Magnus Lie Hetland writes:
>
> -
Hi:
I have begun learning Python by experimenting with the code snippets here:
http://hetland.org/writing/instant-python.html
In the section on functions, Magnus Lie Hetland writes:
For those of you who understand it: When you
15 matches
Mail list logo