Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!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.058 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.01; 'interfaces': 0.04; '(except': 0.07; 'predefined': 0.09; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'violated': 0.16; 'prevent': 0.16; 'language': 0.16; 'wrote:': 0.18; 'rules': 0.22; 'pointer': 0.24; 'java': 0.24; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'message- id:@mail.gmail.com': 0.30; 'follows': 0.31; 'forces': 0.31; 'anyone': 0.31; "can't": 0.35; 'johnson': 0.35; 'no,': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'c++': 0.36; 'data,': 0.36; 'should': 0.36; 'checks': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'details': 0.65; 'notices': 0.68; 'fact,': 0.69; 'protect': 0.79; 'subject:Global': 0.91; 'dirty': 0.93; 'rick': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=y3wTNCZNJcoNwNX+jflULwj1dHlqGSPczsuyKwTPtHI=; b=mjbngkHuzME0u8aF994UDv/THubycrOuGQ0pZaNoIAeAm1NBxBRT+ItHZjhgj8uni2 Q2mE8SxqACrpGY/BbrYSSS5Wn0c2a1NP8rkTxO05YdG+b6IN8KzfcnQaecA5HycFmu9v b8kwxuzd+qvO0spnc7IM9ft3fExOKmJl9rZ5ljXgxeFiaxuDGefoHjjTa5Q5TUQMSjdL 6jXJSzi/WjDuyo7Y2y9HInwl2L91hukbqLTCRBLEi0EFrZzdcYLXo2J94ZI67QFt64vv eodh91jx8xontbzcLaKtE6PxQ1+Th+DReOVUZt7yqGjkTF+d9ZEnmrYsAIjMX8naGAwz qmVw== MIME-Version: 1.0 X-Received: by 10.68.247.36 with SMTP id yb4mr10596078pbc.138.1384232562419; Mon, 11 Nov 2013 21:02:42 -0800 (PST) In-Reply-To: <82561733-d131-45de-ab10-c847f1960dc4@googlegroups.com> References: <7b97786a-2aaf-454c-8c3a-1c19d20d4345@googlegroups.com> <82561733-d131-45de-ab10-c847f1960dc4@googlegroups.com> Date: Tue, 12 Nov 2013 16:02:42 +1100 Subject: Re: PyMyth: Global variables are evil... WRONG! From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384232570 news.xs4all.nl 15908 [2001:888:2000:d::a6]:51134 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59150 On Tue, Nov 12, 2013 at 3:46 PM, Rick Johnson wrote: > But python modules can't be interfaces because interfaces > should protect internal data, prevent external forces from > meddling with internal state (EXCEPT via the rules of a > predefined "contract"), hide dirty details from the caller, > and have clearly defined access points. > > BUT PYTHON MODULES DON'T FOLLOW THIS DESIGN PATTERN! > > No, Python modules can be poked, prodded, and violated by > any pervert who can spell the word "import". And C++ objects can be poked by anyone who can do a pointer cast. And Java objects by anyone who notices that 'const' checks don't apply to byte-code. In fact, the only language I can think of that actually "prevent[s] external forces from meddling with internal state" is HQ9++, which follows the very best principles of data hiding. ChrisA