Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6799
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| 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.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'wed,': 0.03; 'run-time': 0.05; 'subject:()': 0.09; 'subject:blog': 0.09; 'am,': 0.14; 'wrote:': 0.14; '(b,': 0.16; 'a()': 0.16; 'billy': 0.16; 'mro': 0.16; 'object).': 0.16; 'suggest': 0.19; 'object,': 0.19; 'header :In-Reply-To:1': 0.21; 'seems': 0.21; 'resolution': 0.21; 'name?': 0.23; 'received:209.85.161.46': 0.23; 'received:mail- fx0-f46.google.com': 0.23; "doesn't": 0.25; 'subject:use': 0.25; 'received:209.85.161': 0.26; 'object': 0.26; 'message- id:@mail.gmail.com': 0.28; 'subject:how': 0.29; 'class': 0.29; 'subject:post': 0.30; 'determined': 0.32; 'to:addr:python-list': 0.33; '...': 0.34; 'example,': 0.35; 'there': 0.35; 'instances': 0.35; 'sense,': 0.35; 'thus,': 0.35; 'actual': 0.36; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'pretty': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'order': 0.62; 'super': 0.63; 'day,': 0.64; 'vary': 0.65; 'special': 0.66; 'stand': 0.71; 'article': 0.76; 'post)': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=ekQWvD7A+I92r//HTUkUJCTImPck1XfWJoJ+INO6bQU=; b=HvbHf9ZMVyoAEiXpM95xQD5b+eBhPMDLXqqGoCsLWHPp4/C5nrH+X7cXkhH8K1oY+K aCfW7Ytq8X+RdCxUN7Zg9DueC65+MZKSZVeckWXDVvpnSx7gfv4Xa8Zr2bg3JdNxL3HG 9746qO6YgsnhAftefgvtGnljWhqVwEHRCV9k8= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=IN7UNbZs2AeNTf86sWVtKO7rn7QcP6T+0RiZtAxJcPnKnZbhHwoQ/dMvCZeyy6jDpy 3Po/RYbHL1ABbFkC1BNK3RM3u5iMxhMnxFL4q05r5Kxje4fqRVqqY44eDoRTdPgsfBQR l26aerhz4R4KjqcD5Zl+JZ67fpIc+P7n5Khv4= |
| MIME-Version | 1.0 |
| In-Reply-To | <is5dbe$n76$1@speranza.aioe.org> |
| References | <80476fba-1b57-4bb1-9d7d-391edaf3042d@22g2000prx.googlegroups.com> <is5dbe$n76$1@speranza.aioe.org> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 1 Jun 2011 10:42:06 -0600 |
| Subject | Re: Updated blog post on how to use super() |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2368.1306946563.9059.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306946563 news.xs4all.nl 49179 [::ffff:82.94.164.166]:54516 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6799 |
Show key headers only | View raw
On Wed, Jun 1, 2011 at 7:03 AM, Billy Mays <noway@nohow.com> wrote:
> I read this when it was on HN the other day, but I still don't see what is
> special about super(). It seems (from your post) to just be a stand in for
> the super class name? Is there something special I missed?
It's not a stand-in for the super-class name. It's a stand-in for
whatever class is next in the Method Resolution Order (MRO), which is
determined at run-time and can vary depending on what the actual class
of the object is. For example, in this inheritance situation:
class A(object):
...
class B(object):
...
class C(A, B):
...
a = A()
c = C()
The MRO of A is (A, object).
The MRO of B is (B, object).
The MRO of C is (C, A, B, object).
Thus, super(A, a) is going to resolve to object, as you might expect.
But super(A, c) is going to resolve to B, because the next class after
A in the MRO for C instances is B.
That's a pretty quick and dirty explanation. If it doesn't make
sense, I suggest reading the article again.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Updated blog post on how to use super() Raymond Hettinger <python@rcn.com> - 2011-05-31 19:44 -0700
Re: Updated blog post on how to use super() Ben Finney <ben+python@benfinney.id.au> - 2011-06-01 14:26 +1000
Re: Updated blog post on how to use super() Billy Mays <noway@nohow.com> - 2011-06-01 09:03 -0400
Re: Updated blog post on how to use super() Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-01 10:42 -0600
Re: Updated blog post on how to use super() Billy Mays <noway@nohow.com> - 2011-06-01 12:46 -0400
Re: Updated blog post on how to use super() Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-01 11:06 -0600
Re: Updated blog post on how to use super() Chris Torek <nospam@torek.net> - 2011-06-01 17:43 +0000
Re: Updated blog post on how to use super() Duncan Booth <duncan.booth@invalid.invalid> - 2011-06-02 20:58 +0000
csiph-web