Re: [Boost-bugs] [Boost C++ Libraries] #2049: extracting c++ pointer from python object with multiple parents

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2049: extracting c++ pointer from python object with multiple parents
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-06-26 15:02:03


#2049: extracting c++ pointer from python object with multiple parents
-----------------------------------+----------------------------------------
  Reporter: bloodyfanatic_at_[hidden] | Owner: dave
      Type: Bugs | Status: closed
 Milestone: Boost 1.35.1 | Component: Python
   Version: Boost 1.35.0 | Severity: Problem
Resolution: invalid | Keywords:
-----------------------------------+----------------------------------------
Comment (by stefan):

 Dave,

 The use of 'super' with __init__ does in fact work, as long as all classes
 use it:
 {{{
 class A(object):
     def __init__(self):
         super(A, self).__init__()
         print 'A'

 class B(object):
     def __init__(self):
         super(B, self).__init__()
         print 'B'

 class C(A, B):
     def __init__(self):
         super(C, self).__init__()
         print 'C'

 c = C() # prints A B C
 }}}

 The reason for this is pretty well explained in http://fuhm.net/super-
 harmful/. In a nutshell: super() doesn't (necessarily) invoke the
 superclass method itself, but the next one in the MRO chain. If you omit
 super in one case, you break out of this chain.

 FWIW.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2049#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC