On 11/12/2011 02:12 PM, Adam Preble wrote:
Woooah that looks like it does work, although I had to interpret it like so:

class DerivedTest(BaseTest):
   def __init__(self):
     BaseTest.__init__(self)

   def GimmeNumber(self):
     return 100

I don't really consider myself an expert on these things, though I was
Googling around on the proper way to handle the inheritance construction
in Python.  Is this kind of the normal rigors when subclassing in Python
normally, or is this something I must particularly pay attention to when
using Boost?


Calling the base class __init__ is less important in pure Python (i.e. sometimes it's not necessary), but it's still definitely good practice; it depends on whether the base class __init__ does anything important. Python does not ever call it automatically, and in Boost.Python it definitely does something important.

Jim
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to