Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109440
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Multiple inheritance, super() and changing signature |
| Date | Fri, 3 Jun 2016 15:53:58 -0600 |
| Lines | 24 |
| Message-ID | <mailman.137.1464990881.1839.python-list@python.org> (permalink) |
| References | <80ea0ea1-5468-2dee-2c38-c2b09801d0f1@shopzeus.com> <mailman.54.1464711627.1839.python-list@python.org> <574e45f4$0$1611$c3e8da3$5496439d@news.astraweb.com> <a17955cb-04d3-9dd6-e2b3-4719269f241d@shopzeus.com> <85k2i65upp.fsf@benfinney.id.au> <b21d46a9-763a-fe38-b539-77867fcdcdc9@shopzeus.com> <85fusu58pw.fsf@benfinney.id.au> <CALwzid=T7QrDpAJYO715iWtkADEhNV=eenAS96j-gMUEMMPTXQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de n5fVRhUrwXRVH0DJuBNFvwHOYm9uYWoo09mxCtYNnPuw== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '*args,': 0.07; 'cc:addr :python-list': 0.09; 'positional': 0.09; 'received:209.85.218': 0.10; 'python': 0.10; 'def': 0.13; 'argument': 0.15; '2016': 0.16; 'argument.': 0.16; 'cc:name:python': 0.16; 'initialiser': 0.16; "method's": 0.16; 'parameters,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:changing': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'handles': 0.20; 'arguments': 0.22; 'simpler': 0.22; 'specified': 0.23; 'header:In- Reply-To:1': 0.24; 'fri,': 0.27; 'parameters': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; '**kwargs)': 0.29; '**kwargs):': 0.29; 'spam,': 0.29; 'allows': 0.30; "we're": 0.30; 'certain': 0.31; 'skip:_ 10': 0.32; 'class': 0.33; 'except': 0.34; 'skip:d 20': 0.34; 'received:google.com': 0.35; 'next': 0.35; 'should': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'expect': 0.37; 'method': 0.37; 'received:209': 0.38; '"spam"': 0.84; 'to:none': 0.91; 'inheritance,': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=JCjAJElU+Yb4OOKkhbQKjvElAKK1IEcbGFYIDGvzAuI=; b=QpTBrwvKxT11KzR8og9MWCilP/IsvNF2FYeZ/6Gp8ybMKDA6kX2NU2YJKacy5wJlX8 CDMvffo588Om2NS1/9YEZlJPdEU6QsuJUoTYBbVrXdPS7NzKKYATLK92i9qbDt7N2o/7 gBJXCcP/cio54p5DtSbZV13Hdq5Jn4rQJTyFLKgOUE9IHM9XuavZP8TIKCjJDou6zSo0 BEXwwwz65vJPZoFVnthVcqGPq/3znJ5Yr17ZTRKz15iEcL4XR1yXWc0zvLCvTikObQqp gHCFrrXJyf2Rz7wmhJrXMgy6Wxpg2SJOKD7Kbt0aWLPpl4UtTZw4Nid6DvtBjRhvTxXs LHug== |
| 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:from:date :message-id:subject:cc; bh=JCjAJElU+Yb4OOKkhbQKjvElAKK1IEcbGFYIDGvzAuI=; b=bvQoYSoPp1OLSECDDWrRuEp0/nxCPegNuLq4eBHBJRCziBJtrt+sKtqKxyJbBdBvTV SYRDHwUvNc9bh4OVIt+RNu7b5ymWGPTYvdeKjfh3xukigWUcsoRmCNMmY689+mi6UXR/ EfuwA3GNUhhcND9vyyIrMsewPd7OkIKCjLb3NDxX5y5Lmm1aMt+9tg5MfJO8CFhx9rVC q3j+VIDLnxIq1QD0kW14zoFI1q5JWlVmRHdqnO7KU3SpqjAr030Ykd63sV/mFlHSSEy5 hv3EIi/K3dL1EumdRwbVN0Mkpex99ICchEOPmshFr0hwv5B0d5EvpnvWLQb5W8g30rXJ YAcA== |
| X-Gm-Message-State | ALyK8tI44Ww3BerRa4DROX1UcAK4e6dhaSM40KlHJR1vj8jxIxc1SSamBusqyz8hU8HViFf3wrRG5mAnJnrcpA== |
| X-Received | by 10.202.51.133 with SMTP id z127mr3185277oiz.194.1464990877945; Fri, 03 Jun 2016 14:54:37 -0700 (PDT) |
| In-Reply-To | <85fusu58pw.fsf@benfinney.id.au> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <CALwzid=T7QrDpAJYO715iWtkADEhNV=eenAS96j-gMUEMMPTXQ@mail.gmail.com> |
| X-Mailman-Original-References | <80ea0ea1-5468-2dee-2c38-c2b09801d0f1@shopzeus.com> <mailman.54.1464711627.1839.python-list@python.org> <574e45f4$0$1611$c3e8da3$5496439d@news.astraweb.com> <a17955cb-04d3-9dd6-e2b3-4719269f241d@shopzeus.com> <85k2i65upp.fsf@benfinney.id.au> <b21d46a9-763a-fe38-b539-77867fcdcdc9@shopzeus.com> <85fusu58pw.fsf@benfinney.id.au> |
| Xref | csiph.com comp.lang.python:109440 |
Show key headers only | View raw
On Fri, Jun 3, 2016 at 2:16 PM, Ben Finney <ben+python@benfinney.id.au> wrote: > If you're writing a custom initialiser that handles two additional > parameters, then those parameters should not be present when you call > the super() method's initialiser:: > > # You specified Python 3, which allows simpler syntax. > > class LoremIpsum: > def __init__(self, spam, *args, **kwargs): > do_something_important_with(spam) > super().__init__(*args, **kwargs) > > class DolorSitAmet(LoremIpsum): > def __init__(self, spam, eggs=4, beans=None, *args, **kwargs): > self.eggs = eggs > self.beans = beans > super().__init__(spam, *args, **kwargs) Except that since we're discussing design for multiple inheritance, the positional argument "spam" is inappropriate. All arguments should be passed by keyword; the DolorSitAmet.__init__ method cannot be certain that LoremIpsum will be the next class in the MRO, and the actual next class might not expect spam to be the first positional argument.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-05-31 18:10 +0200
Re: Multiple inheritance, super() and changing signature Steven D'Aprano <steve@pearwood.info> - 2016-06-01 12:18 +1000
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-03 14:10 +0200
Re: Multiple inheritance, super() and changing signature Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-04 13:06 +1200
Re: Multiple inheritance, super() and changing signature Steven D'Aprano <steve@pearwood.info> - 2016-06-04 12:51 +1000
Re: Multiple inheritance, super() and changing signature Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-04 23:50 +1200
Re: Multiple inheritance, super() and changing signature Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-03 23:05 -0600
Re: Multiple inheritance, super() and changing signature Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-04 23:52 +1200
Re: Multiple inheritance, super() and changing signature Steven D'Aprano <steve@pearwood.info> - 2016-06-04 23:46 +1000
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-04 16:42 +0200
Re: Multiple inheritance, super() and changing signature Ben Finney <ben+python@benfinney.id.au> - 2016-06-03 22:21 +1000
Re: Multiple inheritance, super() and changing signature Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-04 13:10 +1200
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-03 14:14 +0200
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-03 14:57 +0200
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-03 16:06 +0200
Re: Multiple inheritance, super() and changing signature Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-03 08:39 -0600
Re: Multiple inheritance, super() and changing signature Michael Selik <michael.selik@gmail.com> - 2016-06-03 15:33 +0000
Re: Multiple inheritance, super() and changing signature Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-03 17:59 +0200
Re: Multiple inheritance, super() and changing signature Michael Selik <michael.selik@gmail.com> - 2016-06-03 16:28 +0000
Re: Multiple inheritance, super() and changing signature Ben Finney <ben+python@benfinney.id.au> - 2016-06-04 06:16 +1000
Re: Multiple inheritance, super() and changing signature Ben Finney <ben+python@benfinney.id.au> - 2016-06-04 06:19 +1000
Re: Multiple inheritance, super() and changing signature Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-03 15:53 -0600
Re: Multiple inheritance, super() and changing signature Ben Finney <ben+python@benfinney.id.au> - 2016-06-04 10:44 +1000
csiph-web