Re: Alias for an attribute defined in a superclass

2011-04-01 Thread Jean-Michel Pichavant
Raymond Hettinger wrote: On Mar 31, 3:14 pm, Ben Finney 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 s

Re: Alias for an attribute defined in a superclass

2011-03-31 Thread Raymond Hettinger
On Mar 31, 3:14 pm, Ben Finney 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): >    

Re: Alias for an attribute defined in a superclass

2011-03-31 Thread Ben Finney
Steven D'Aprano writes: > On Fri, 01 Apr 2011 09:14:03 +1100, Ben Finney wrote: > > > I want to inherit from a class, and define aliases for many of its > > attributes. > > Are these aliases of arbitrary aliases, or only of methods, as in your > example below? I'd like to know how to do either,

Re: Alias for an attribute defined in a superclass

2011-03-31 Thread Ben Finney
Calvin Spealman writes: > Sounds like you're just going to end up with more confusing code > having multiple ways to refer to the exact same thing. Why? (Why did you top-post?) I'm defining aliases to conform to an existing API. The “Foo” class's attributes are what is needed, but not by the ri

Re: Alias for an attribute defined in a superclass

2011-03-31 Thread Calvin Spealman
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 wrote: > Howdy all, > > I want to inherit from a class, and define aliases for many of its > attributes. How can I refer to “the

Re: Alias for an attribute defined in a superclass

2011-03-31 Thread Steven D'Aprano
On Fri, 01 Apr 2011 09:14:03 +1100, Ben Finney wrote: > Howdy all, > > I want to inherit from a class, and define aliases for many of its > attributes. Are these aliases of arbitrary aliases, or only of methods, as in your example below? > How can I refer to “the attribute that will be avail