Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Encapsulation in Python Date: Sun, 13 Mar 2016 15:05:22 +1100 Lines: 26 Message-ID: References: <56E17985.7060002@benmezger.nl> <6984dafc-fffd-4d46-a173-421bb5c142d2@googlegroups.com> <69479550-3abf-4a11-a583-1cc549220b08@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 1FxBtGCKjtnfbVnCcJbruQVtPGcd3heelPYl3onq4uwQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'elif': 0.04; 'subject:Python': 0.05; 'exception.': 0.07; 'cc:addr:python- list': 0.09; 'importerror': 0.09; 'tracing': 0.09; ':-)': 0.12; '2016': 0.16; 'absolute,': 0.16; 'behaviour.': 0.16; 'fatal': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'judge,': 0.16; 'modules,': 0.16; 'pulling': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suppose': 0.22; 'this:': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'example': 0.26; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'looks': 0.29; '13,': 0.29; 'complain': 0.29; 'received:209.85.213.174': 0.29; 'raise': 0.29; 'another': 0.32; 'good.': 0.32; 'foo': 0.33; 'symbol': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'modules': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; '12,': 0.37; 'johnson': 0.37; 'received:209.85.213': 0.37; 'doing': 0.38; 'received:209': 0.38; 'wrong': 0.38; 'does': 0.39; 'along': 0.39; 'provide': 0.61; 'saturday,': 0.63; 'more': 0.63; 'necessarily': 0.63; 'march': 0.64; 'mar': 0.65; 'detail.': 0.66; '2:36': 0.84; 'chrisa': 0.84; 'ha,': 0.84; 'terrible': 0.84; 'to:none': 0.91; 'rick': 0.93; 'subject:skip:E 10': 0.96 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:cc; bh=etNq+RBhupscZl4DiOday3By0OXVEK1I9IyjWHfdUCA=; b=Mlq1YJAouLm7fyYX82DbAMEvSPK1tTZACkDl6l7rLPRQsb+jWcqGkPsXnkSiMcH8GG QWey0rvq8qt2MNMAUrm46NXhKlnQMSZrWAY3M304IaxnYFZWdUc5IycUrYHF95NT94s2 YbwgxtfEks0+BEZvdXh4b/P6F++23X5gP2Id5zHcCqvgX6JFhp0dq1oJV7lsoOrqNNgR whqbUEtvIvn3ilaOC9P7agSAE7OAnRb+celKbAOpZFwKDbdMihpDwFUFPOveOt2Z9jAo wjFdoRD5dO9h9c5YBpX4cLMQV3hnfwJQKBxthyQ0ku9BvLIu+PiPM32S337fZLPafNY/ gOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=etNq+RBhupscZl4DiOday3By0OXVEK1I9IyjWHfdUCA=; b=YgxnXwxTVnzp0Kc9ssNCN86DxMI6m1dT6ru9AHa28IOcruCmWpiQeELxjqLUx/6czS BgbOFzICvKd1xSOq/zrOYA0okOYAG0ZN1q8HyFrGXpgqpo3qKjOI1qu496e3vZZoa7+M EBrrlitHaSEjBTddicZwCBrfN8/QbYvl69v6QKXzlsstTQOj5E7gvyo7/n39pT8r+Fg3 ZRAxCILPk14Viu3D4lxwJUJS2j3t6H9Fltgr+JeZxjW+7t+qhveuRoiVcbrZGj28hP33 OuoaQLCsEwIDRFp5NEaCojLGuLuBhmfT1MNLBtuVg8CKLGsuRXNvaLcejS6A3cNUwQh8 T7yA== X-Gm-Message-State: AD7BkJIlMAXNJuHiX2X9FBjl/d7WFAH2Prtp230dkKl+RcIJ5ypDBfrWT+kYTXs8vA6ZPTaYFIRRQGy7kKR5hA== X-Received: by 10.50.136.194 with SMTP id qc2mr11473983igb.13.1457841922529; Sat, 12 Mar 2016 20:05:22 -0800 (PST) In-Reply-To: <69479550-3abf-4a11-a583-1cc549220b08@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104747 On Sun, Mar 13, 2016 at 2:36 PM, Rick Johnson wrote: > On Saturday, March 12, 2016 at 3:10:49 PM UTC-6, Chris Angelico wrote: >> Also, if currentModule.py is pulling foo from modX, then modZ.py is an >> implementation detail. You don't necessarily want to go straight >> there; tracing the chain is more likely to be the correct behaviour. >> Suppose modX.py actually looks like this: >> >> if 'posix' in some_magic: >> import posixY as modY >> elif 'nt' in some_magic: >> import ntY as modY >> else: >> raise ImportError > > Ha, well, along with my example, this is another good > example of a very bad design ;-). It's a terrible sin to > import a symbol through multiple modules, but to import a > symbol through multiple modules *AND* redefine it along the > way, well, that should be punishable by the fatal exception. > No judge, no jury. Just swift, and absolute, justice. :-) Good. Go complain to the os module about how it's doing the wrong thing. This is exactly what it does to provide os.path. ChrisA