Hi Alex, On 17/08/15 02:54 PM, Alex Mohr wrote: > On 8/17/2015 11:39 AM, Stefan Seefeld wrote: >> For the case with default implementation, the tutorial gives this >> wrapper: >> >> struct BaseWrap : Base, bpl::wrapper<Base> >> { >> virtual std::string func() const >> { >> if (bpl::override f = this->get_override("func")) >> return f(); >> else >> return Base::func(); >> } >> std::string default_func() const { return this->Base::func();} >> }; >> >> and it seems to me much more natural to implement the "default" case >> directly in the "else" branch above, rather than add it to the >> "def()" call. > > I think this might be so that python can invoke the superclass (C++) > implementation directly in its override, but I'm not 100% sure.
Ah, that's it ! I just tried Konsole output >>> class C(Base): ... def func(self): return super(C, self).func() which yields an infinite recursion (until stack overflow) unless I define "func" with the additional default function. Thanks ! Stefan -- ...ich hab' noch einen Koffer in Berlin... _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig