Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'classes.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'class:': 0.16; 'inheritance': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tempted': 0.16; 'module': 0.19; 'aug': 0.22; 'print': 0.22; 'url:home': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'forgot': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'steven': 0.31; 'class': 0.32; 'skip:_ 10': 0.34; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'talking': 0.65; '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: Mon, 19 Aug 2013 18:57:10 -0400 Organization: IISS Elusive Unicorn References: <8255dfbd-a2a1-4ab7-b900-ee19faa459f2@googlegroups.com> <520fa223$0$30000$c3e8da3$5496439d@news.astraweb.com> <5211c3cc$0$29885$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-223-128.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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376953036 news.xs4all.nl 15887 [2001:888:2000:d::a6]:35851 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52708 On 19 Aug 2013 07:05:48 GMT, Steven D'Aprano declaimed the following: > >I'm not actually talking about monkey-patching. I'm talking about just >normal inheritance of classes. E.g. If a module has this class: > > >class Parrot: > def __init__(self): > self._name = "Polly" > def talk(self): > print "%s wants a cracker!" % self._name > > >I might be tempted to do this: > >class MyParrot: > def __init__(self): > super(MyParrot, self).__init__() > self._name = "George" > Which will do nothing... you forgot to subclass... class MyParrot(Parrot): > -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/