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


Groups > comp.lang.python > #12451

RE: Get reference to parent class from subclass?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'completeness': 0.05; 'subject:reference': 0.09; 'message-----': 0.12; '712': 0.16; 'currencies': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'privilege,': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:169.70.190': 0.16; 'received:172.18.0': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; "haven't": 0.20; 'trying': 0.21; 'header:In-Reply-To:1': 0.22; 'received:169.254.1': 0.23; 'to:name:python-list@python.org': 0.23; 'classes': 0.28; 'pass': 0.29; '27,': 0.29; 'parent': 0.30; 'received:155': 0.30; 'received:159': 0.30; 'class': 0.30; 'subject:?': 0.31; 'subject:': 0.32; 'probably': 0.33; 'to:addr :python-list': 0.33; 'sent:': 0.33; 'received:169': 0.34; 'received:169.254': 0.34; 'received:172.18': 0.34; 'phone:': 0.35; 'reference': 0.35; 'object': 0.35; 'charset:us-ascii': 0.36; 'header:Received:8': 0.36; 'accuracy': 0.37; 'skip:p 50': 0.37; 'but': 0.37; 'think': 0.38; 'from:': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'skip:- 10': 0.39; 'to:addr:python.org': 0.39; 'subject:from': 0.40; 'subject': 0.61; 'john': 0.62; 'super': 0.64; 'information,': 0.65; 'legal': 0.70; 'august': 0.70; 'subject:Get': 0.71; 'url:email': 0.74; 'sale': 0.75; 'bank': 0.76; 'investment': 0.77; 'purchase': 0.84; 'subject:class': 0.84
X-DKIM Sendmail DKIM Filter v2.5.6 sz2.jpmchase.com p7ULQYJC017839
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=jpmorgan.com; s=smtpout; t=1314739594; bh=dwzBpUC7kDV72LROjy0sdRDf2u21bNdb0eGXfk+ x5dY=; h=From:To:Date:Subject:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=czvKA5ju7g7 pkDm9luXswtMLo3NtHMwBaNKVj+lpIssVgrrAUcoz+nG2yz4ojev3MRHr4uuyYyeFpf 7bZoTYx+raZf2a+TD7y0lOgwIydi1wo9PAYFh0bNIzZxJxiVjMC6IpCdnQUDDokgTxu JHrW0sRXk3LUCH1AripQclyRUQ=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <python-list@python.org>
Date Tue, 30 Aug 2011 17:26:24 -0400
Subject RE: Get reference to parent class from subclass?
Thread-Topic Get reference to parent class from subclass?
Thread-Index AcxmO3MIvqVLklbKSPOTbkeKqEIFCwBH6v0Q
References <20110828140024.f945cf73052f0c39b0a22a99@johnohagan.com>
In-Reply-To <20110828140024.f945cf73052f0c39b0a22a99@johnohagan.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
acceptlanguage en-US
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
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.583.1314739602.27778.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314739602 news.xs4all.nl 2531 [2001:888:2000:d::a6]:47428
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12451

Show key headers only | View raw


-----Original Message-----
From: python-list-bounces+ramit.prasad=jpmorgan.com@python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan.com@python.org] On Behalf Of John O'Hagan
Sent: Saturday, August 27, 2011 11:00 PM
To: python-list@python.org
Subject: Get reference to parent class from subclass?

class P():
    pass

class C(P):
    pass

Can I get P from C? 

IOW, can I get a reference to the object P from the object C? This should be obvious one way or the other, but I haven't been able to find the answer.

Regards,

John
-- 


You should be able to access what you need via the super() built-in. I am not entirely sure what you are trying to do...but I think usage of super is probably better than trying to access the base classes manually.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

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


Thread

RE: Get reference to parent class from subclass? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2011-08-30 17:26 -0400

csiph-web