Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52308

Python Basic Doubt

Date 2013-08-10 21:03 +0530
Subject Python Basic Doubt
From Krishnan Shankar <i.am.songoku@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.428.1376151419.1251.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Fellow Python Friends,

I am new to Python and recently subscribed to the mailing list.I have a
doubt regarding the basics of Python. Please help me in understanding the
below concept.

So doubt is on variables and their contained value.

Why does in the below example from Interpreter exploration value of c take
pre existing memory location.

>>> a=10
>>> id(a)
21665504
>>> b=a
>>> id(b)
21665504
>>> c=10
>>> id(c)
21665504

I am actually assigning new value to c. But from the value of id() all
three variables take same location. With variables a and b it is ok. But
why c taking the same location?

Regards,
Krishnan

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Python Basic Doubt Krishnan Shankar <i.am.songoku@gmail.com> - 2013-08-10 21:03 +0530
  Re: Python Basic Doubt Roy Smith <roy@panix.com> - 2013-08-10 12:35 -0400

csiph-web