Simple Traits Questions

Robert Kern robert.kern at
Sun Mar 28 01:23:51 CET 2010

On 2010-03-27 08:19 , Ethan Furman wrote:
> Okay, different post for my actual questions.  :)
> On the PyPI page for strait (
> it has the example of choosing which methods to keep in the composed class:
> class TOSWidget(BaseWidget):
> __metaclass__ = include(Pack, Place, Grid)
> info =
> config = Pack.config.im_func
> configure = Pack.configure.im_func
> slaves = Pack.slaves.im_func
> forget = Pack.forget.im_func
> propagate = Pack.propagate.im_func
> My question is:
> Why use
> info =
> instead of
> info =
> ? is an unbound method object attached to the Pack class, not a function 
object. It has some extra semantics on top of functions and is tied to the Pack 
class. The .im_func attribute gets the actual function object underneath. When 
defining the TOSWidget class, the objects defined in the suite under the class: 
statement need to be actual functions in order to be turned into unbound methods 
attached to the TOSWidget class.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list