Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104747

Re: Encapsulation in Python

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Encapsulation in Python
Date Sun, 13 Mar 2016 15:05:22 +1100
Lines 26
Message-ID <mailman.55.1457841930.12893.python-list@python.org> (permalink)
References <56E17985.7060002@benmezger.nl> <mailman.139.1457623672.15725.python-list@python.org> <6984dafc-fffd-4d46-a173-421bb5c142d2@googlegroups.com> <dkh7i8Frq0gU1@mid.individual.net> <a619fe22-7152-4da6-b571-3efc29914936@googlegroups.com> <mailman.44.1457817037.12893.python-list@python.org> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:104747

Show key headers only | View raw


On Sun, Mar 13, 2016 at 2:36 PM, Rick Johnson
<rantingrickjohnson@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 08:27 -0700
  Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-10 16:45 -0800
    Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-11 08:47 -0700
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-11 18:39 -0800
        Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-12 09:44 -0700
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 19:11 -0800
          Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-13 21:11 +1100
            Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 10:32 -0700
              Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-14 15:09 -0600
              Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 21:23 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 22:07 +0000
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 22:20 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 22:40 +0000
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 23:19 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 23:56 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:12 +1100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 00:54 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:58 +1100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 01:22 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 13:02 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 00:28 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 01:10 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 12:23 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:41 +0000
                Re: Encapsulation in Python rurpy@yahoo.com - 2016-03-14 17:17 -0700
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:25 +1100
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:06 +1100
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 13:14 +1100
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:40 +1100
                Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 21:08 -0700
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 00:47 +0000
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:46 +1100
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:56 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:36 +0000
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:01 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:45 +0000
                Re: Encapsulation in Python Christian Gollwitzer <auriocus@gmx.de> - 2016-03-15 22:02 +0100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-16 00:39 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-16 22:58 +0000
        Re: Encapsulation in Python sohcahtoa82@gmail.com - 2016-03-14 11:11 -0700
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 23:09 -0700
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-11 18:56 -0800
    Re: Encapsulation in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-12 13:52 +1300
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 08:49 -0800
        Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-13 08:10 +1100
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 19:36 -0800
            Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-13 15:05 +1100
        Re: Encapsulation in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-14 12:35 +1300
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 15:55 -0700

csiph-web