Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'classes,': 0.05; 'subject:Python': 0.06; 'bits': 0.09; 'forms,': 0.09; 'methods,': 0.09; 'wrapper': 0.09; 'xml.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'jan': 0.12; "wouldn't": 0.14; 'args,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inheritance': 0.16; 'sure.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'else,': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'helper': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'generally': 0.29; 'thus': 0.29; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; 'code': 0.31; 'usually': 0.31; '25,': 0.31; 'names.': 0.31; 'class': 0.32; 'figure': 0.32; 'classes': 0.35; 'common': 0.35; 'created': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'functions.': 0.36; 'right?': 0.36; 'useful': 0.36; 'easiest': 0.38; 'anything': 0.39; 'full': 0.61; 'simple': 0.61; 'rendering': 0.68; 'construction': 0.72; 'felt': 0.74; 'scratch,': 0.84; 'to:none': 0.92 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 :content-type:content-transfer-encoding; bh=dZvJier6lIbu728ET/ZBbsAayot5D/fSotBhel+61KM=; b=ZV5UkKPv864ao+z9YHlRaFZ+oGyFmSaSfhlr53nspJJYMUd+Eo7zZFqyALpRNSjhGw EeDcivdQ9toVAKoEwGvyHPFojTw1o0oIVhiylyAfjDUqB+plwOP/L7+NjrnFCw5zun5y SOpwkIsTIauktu4id2JMhdY3fPRVf6ltEfRWQ1XdhBtHnD+3Yh3GIUpmohtSoXyp/eZt 2WfqXAoD6dcc44gShRv7L0rsNMN9oqpsgHDFGeQuq1hwu5SR/Ytj6wjx7BlrSHKzdq5P h+u4ckV67YN8G3PS7J0l0SuFdyTsaozgSdbP1cRpEll+CjG41Zv93HwVHeKC4L8S6phj ylGA== MIME-Version: 1.0 X-Received: by 10.68.98.3 with SMTP id ee3mr15471966pbb.31.1390581207732; Fri, 24 Jan 2014 08:33:27 -0800 (PST) In-Reply-To: <20140124162842.0E73240FC2@wycliff.ceplovi.cz> References: <8fde6d34-47c5-49a1-a6d0-9ffe3df2d401@googlegroups.com> <20140124162842.0E73240FC2@wycliff.ceplovi.cz> Date: Sat, 25 Jan 2014 03:33:27 +1100 Subject: Re: Python declarative From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390581211 news.xs4all.nl 2904 [2001:888:2000:d::a6]:57216 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64694 On Sat, Jan 25, 2014 at 3:28 AM, Mat=C4=9Bj Cepl wrote: > On 2014-01-24, 11:18 GMT, you wrote: >> Write your rendering engine as a few simple helper functions, >> and then put all the rest in as code instead of XML. The >> easiest way to go about it is to write three forms, from >> scratch, and then look at the common parts and figure out >> which bits can go into helper functions. > > Perhaps what's missing is full acknowledgment that Python has > dual-inheritance and thus it can have mixin classes (which seems > to me to be the only useful use of dual inheritance). You know > you can have mixins in Python, right? Hmm, I've never really felt the need to work that way. Usually it's functions I want, not classes; but if they're classes, then generally they're just to add a couple of methods, or change the construction args, so single inheritance is plenty. (I created a MultiLineEntryField class as a thin wrapper around TextView, adding get_text() and set_text() with the same signatures as GTK2.Entry()'s methods of the same names. That wouldn't apply to anything else, so a mixin wouldn't help much.) But sure. If you want mixins, go for it. ChrisA