Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'alter': 0.09; 'messing': 0.09; 'cc:addr:python-list': 0.11; 'cliff': 0.16; 'foot': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'sat,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'mention': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'points': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '-0700,': 0.31; "d'aprano": 0.31; 'shoot': 0.31; 'steven': 0.31; 'programmers': 0.33; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'easily': 0.37; 'fact': 0.38; 'how': 0.40; 'removing': 0.60; 'august': 0.61; 'here': 0.66; 'subject:skip:E 10': 0.95; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=i4FUwgGaXT5Wc8EhF9hg2jUBekIYgUFi57vQzUHrfq8=; b=p6ltcDo8IjDK646MCsEMiNSSnwrpCHxwfjs4cz8SxAh57SGoWgSj9F1Y70y/c21lS4 eoE57B8xeUsFBjzYGxnhQ8FyKrxedI+joEtdBsJTTsb9JmVLXAXs3C2OwdRmQMS5YXAG ctFMCAopVF9RpHhjGgYPYn7jqeFVVW24YXq+nLtzYECL+nQQULf2hnwGMfvzV0vtZxPZ ZHynM0/o/PfvwHelF6XbD7Do4o74E/xTsEgxhCtibxk7r9kpQC+2woyZKCv782rNYF6f rVK1ZSK41XEZnz/FxRCZxIkYasAkNvEmzP8nSOPzCiy5ENT0yyJwnSfkXxMdvZOu64/c olyg== X-Received: by 10.112.35.52 with SMTP id e20mr7792960lbj.11.1376846150315; Sun, 18 Aug 2013 10:15:50 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: <520fa223$0$30000$c3e8da3$5496439d@news.astraweb.com> References: <8255dfbd-a2a1-4ab7-b900-ee19faa459f2@googlegroups.com> <520fa223$0$30000$c3e8da3$5496439d@news.astraweb.com> From: Joshua Landau Date: Sun, 18 Aug 2013 18:15:10 +0100 X-Google-Sender-Auth: E7ii-c3HyHlvWCL-vWF9M0eFT88 Subject: Re: Encapsulation unpythonic? To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376846158 news.xs4all.nl 15888 [2001:888:2000:d::a6]:54466 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52657 On 17 August 2013 17:17, Steven D'Aprano wrote: > On Sat, 17 Aug 2013 05:26:32 -0700, fsaldan1 wrote: >> how do I >> deal with the fact that other programmers can easily alter the values of >> members of my classes? > ... > If they insist on messing with your private single-underscore > _attributes, you can't stop them, but that's okay, you don't have to be > sympathetic when they shoot their foot off. Just slap them with a large > halibut[1] and laugh. I know I've cropped your points but I just want to mention here that the only reason to monkey-patch code in these ways where you'd want to stop them is when the alternative is *worse*. It's like removing railings from a cliff to stop people hitting the bars.