newbie looking for help, int reference question

jodocus johocus at zonnet.nl
Tue Jan 14 13:07:19 EST 2003


hi,

i am learning python, but at the moment i cannot afford to buy a book on
the subject. So i am trying to find all the appropriate information on the
web. This proves difficult, so if anyone knows a good (complete) online
book/resource about the language, i would like to know. I am looking for
more than just a tutorial (these are not hard to find), but rather a
complete work that describes the details of the language.

A thing I just ran into and couldn't find in the tutorials i am using:

>>> i = 10
>>> j = i
>>> i is j
1
>>> i += 10
>>> i
20
>>> j
10

it seems that, after adding a value, i has become another object. So i
guess the + operator makes a new object, does this mean that ints are
'immutable'? How do i make sure that j changes when i does? Is this
comparable to the Java distinction between objects and primitive types,
where objects are referenced but primitives are not?

As a C/C++ programmer i really like to know whether i am dealing with
pointers or not, this makes me feel more sure about the correctness of the
code i am writing.

Thanks a lot,

R




More information about the Python-list mailing list