Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'interpreter': 0.05; 'subject:Python': 0.06; 'variables': 0.07; 'assigning': 0.09; 'python': 0.11; 'list.i': 0.16; 'value.': 0.19; '>>>': 0.22; 'memory': 0.22; 'example': 0.22; '>>>': 0.24; 'pre': 0.24; 'friends,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'ok.': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'doubt': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'skip:u 10': 0.60; 'new': 0.61; 'taking': 0.65; 'concept.': 0.84; 'location?': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=tDl5dGyC1sNq45HB5F31EjV9vmLq5PkYSbVuAjYEbEs=; b=oMXgvwgAi/29+Fk4ulx4i1IhwgKw5jNjjkajIHXT92sV6Qj2CzkHLfiO4p600SVzOh 25j7YXZi3WKeTMTJqKvmQtu4632AvmsWeQZWWOarJhXs8j0JmZtssZ6GZxopnFt7s3HP F8GVljH1SSs3aIA7Jxd9Sh9yrsKNhFMnlUtub00Nm+s8X+L9eZ6SmjIXA6digpEWTP9k L9CCGQGSkplzIZzYeE2gK5sZAV3RLtTiSmVed+bNyEVrZ6E/pFckcul0hZuiyA/rowXS fQWVZJjDxTpYyPzuwcXvJASKjSjiYy7YsFmJ484CbQFA45+i8a9JfYLmGeId3j8DAY5L o73w== MIME-Version: 1.0 X-Received: by 10.194.19.228 with SMTP id i4mr2949490wje.87.1376148816757; Sat, 10 Aug 2013 08:33:36 -0700 (PDT) Date: Sat, 10 Aug 2013 21:03:36 +0530 Subject: Python Basic Doubt From: Krishnan Shankar To: python-list@python.org Content-Type: multipart/alternative; boundary=047d7b450ece6187ec04e3999df4 X-Mailman-Approved-At: Sat, 10 Aug 2013 18:16:58 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376151419 news.xs4all.nl 15961 [2001:888:2000:d::a6]:57222 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52308 --047d7b450ece6187ec04e3999df4 Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b450ece6187ec04e3999df4 Content-Type: text/html; charset=ISO-8859-1
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





--047d7b450ece6187ec04e3999df4--