Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.octanews.net!mauve.octanews.net!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Alias for an attribute defined in a superclass X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney Date: Fri, 01 Apr 2011 09:14:03 +1100 Message-ID: <87sju3ndjo.fsf@benfinney.id.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:NxthFzm71YF5j0shjPlUlNHkeM4= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 26 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: 19cc3ab0.news.astraweb.com X-Trace: DXC=g2JNi6XY336JQj]j1AWO\;L?0kYOcDh@:W\:Hm@YlDb:?ca>[jolac=UGD@iN[Hd??CNnn^goOO^8 Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2307 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