Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2321
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ironfroggy@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.078 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'instance': 0.05; 'attribute': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'aliases': 0.16; 'attributes.': 0.16; 'finney': 0.16; 'innovations': 0.16; 'class,': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'thu,': 0.22; 'define': 0.26; 'url:mailman': 0.27; 'message- id:@mail.gmail.com': 0.28; 'class': 0.29; 'sort': 0.30; 'cc:addr:python.org': 0.31; 'all,': 0.31; 'url:listinfo': 0.33; 'using': 0.34; 'open': 0.35; 'problems': 0.37; 'it?': 0.37; 'refer': 0.37; 'should': 0.37; 'received:209.85': 0.37; 'url:python': 0.37; 'depend': 0.38; 'received:google.com': 0.38; 'ways': 0.38; 'url:org': 0.38; 'end': 0.39; 'received:209': 0.39; 'how': 0.39; 'header:Received:5': 0.40; 'exact': 0.60; '2011': 0.62; 'mar': 0.64; 'skip:\xe2 10': 0.72; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'protecting': 0.73; 'reply-to:addr:gmail.com': 0.78; 'confidence': 0.80; 'blog!': 0.84; '\xe2\x80\x9cthe': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=UQsRBefi+usMjPtRKMMwvxgXDToLBr5sweIvgNEfWG8=; b=Y+Vc5kNzuWsIyoqfHaMEJixp0Z31Ers8WW5Y4hPGLcLj4BUThcQYiCYJV3aJo/hh95 oYZ+hS1YUJxJDD7sWuXCVKqz7zQUwpGDureCjmVlE9ULKKKYatTZJENATz05zf6N8sSy AouCnKG7WE8B3p0dJRKw1ioS/jEm7QWFJqq7Q= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=V9V1lM8r3dZ6bluwIDqwLZXi/Mq4izfyQA9fdxXvkF3HSUFvPHb7xsmpp9tKBUDVxH 3kUMPrS/+J7SY5F4R1kQ5imOgzfUILfDCfiZVIrzQUdoqo4dghOKu8tZAZeT3mhoBpRG yhrpcBe9dini2fo5rGw98yF514frUpmnu7PF4= |
| MIME-Version | 1.0 |
| In-Reply-To | <87sju3ndjo.fsf@benfinney.id.au> |
| References | <87sju3ndjo.fsf@benfinney.id.au> |
| From | Calvin Spealman <ironfroggy@gmail.com> |
| Date | Thu, 31 Mar 2011 20:36:09 -0400 |
| Subject | Re: Alias for an attribute defined in a superclass |
| To | Ben Finney <ben+python@benfinney.id.au> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | ironfroggy@gmail.com |
| 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.57.1301618196.2990.python-list@python.org> (permalink) |
| Lines | 48 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1301618196 news.xs4all.nl 41110 [::ffff:82.94.164.166]:41353 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2321 |
Show key headers only | View raw
Sounds like you're just going to end up with more confusing code having multiple ways to refer to the exact same thing. Why? On Thu, Mar 31, 2011 at 6:14 PM, Ben Finney <ben+python@benfinney.id.au> wrote: > Howdy all, > > I want to inherit from a class, and define aliases for many of its > attributes. How can I refer to “the attribute that will be available by > name ‘spam’ once this class is defined”? > > class Foo(object): > def spam(self): > pass > > def eggs(self): > pass > > class Bar(Foo): > beans = Foo.spam > mash = Foo.eggs > > Is that the right way to do it? Will that leave me open to “unbound > method” or “is not an instance of ‘Bar’” or other problems when using > ‘Bar.beans’? > > -- > \ “If [a technology company] has confidence in their future | > `\ ability to innovate, the importance they place on protecting | > _o__) their past innovations really should decline.” —Gary Barnett | > Ben Finney > -- > http://mail.python.org/mailman/listinfo/python-list > -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Alias for an attribute defined in a superclass Ben Finney <ben+python@benfinney.id.au> - 2011-04-01 09:14 +1100
Re: Alias for an attribute defined in a superclass Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-01 00:14 +0000
Re: Alias for an attribute defined in a superclass Ben Finney <ben+python@benfinney.id.au> - 2011-04-01 11:59 +1100
Re: Alias for an attribute defined in a superclass Calvin Spealman <ironfroggy@gmail.com> - 2011-03-31 20:36 -0400
Re: Alias for an attribute defined in a superclass Ben Finney <ben+python@benfinney.id.au> - 2011-04-01 11:57 +1100
Re: Alias for an attribute defined in a superclass Raymond Hettinger <python@rcn.com> - 2011-03-31 19:24 -0700
Re: Alias for an attribute defined in a superclass Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-04-01 11:54 +0200
csiph-web