Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"a"': 0.16; 'garbage': 0.16; 'message- id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tuple': 0.16; 'aug': 0.22; 'creating': 0.23; 'integer': 0.24; 'url:home': 0.24; 'java': 0.24; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'statement': 0.30; 'object.': 0.31; 'fri,': 0.33; 'could': 0.34; 'objects': 0.35; 'there': 0.35; 'object,': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'major': 0.40; 'new': 0.61; 'first': 0.61; 'name': 0.63; 'taking': 0.65; 'statement,': 0.68; 'received:108': 0.93; 'subject:skip:E 10': 0.95; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Encapsulation unpythonic? Date: Sat, 31 Aug 2013 13:31:28 -0400 Organization: IISS Elusive Unicorn References: <8255dfbd-a2a1-4ab7-b900-ee19faa459f2@googlegroups.com> <8c7c4854-70e1-46e7-a3ff-a3206c4c5c27@googlegroups.com> <5221567b$0$6599$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-217-85.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377970295 news.xs4all.nl 15972 [2001:888:2000:d::a6]:42783 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53371 On Fri, 30 Aug 2013 23:07:47 -0700 (PDT), Fabrice Pombet declaimed the following: >well, look at that: > >a=(1,2) >a=2+3 ->a is an object and I have changed its type and value from outside. As far as I am concerned this is one hell of an encapsulation violation... Could you do this -strictly speaking- in Java or C++? There is where your major misunderstanding is... "a" is a NAME attached (bound) to an object. In the first statement, the object is the tuple (1,2). That object was not changed when you execute the second statement -- which is taking two integer objects and creating a new integer object having a value of '5', and then attaches the NAME "a" to the new object. If no other names are bound to the (1,2) object, it will be garbage collected. At no time do you change the type/value of the OBJECT. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/