On Mar 31, 3:14 pm, Ben Finney <ben+pyt...@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?
For methods, that will work just fine. For attributes, you will need to make @property accessors that get and set the underlying attribute. Raymond -- http://mail.python.org/mailman/listinfo/python-list