number_sub(num number_display(numprint(number_square(num)use accessor functions in the module number_data_set(num print(number_data_get(num)number_display(numprint(numdelete_number(numthis script generates essentially the same output as main pybut it' been slightly simplifiedand the +class instance is something lower level than the proxy class here/pp /integrate/extend/swig/shadowpython main_low py number add number= sub number= number= aa _p_number ~number subclassing the +class in python using the extension module directly worksbut there is no obvious advantage to moving from the shadow class to functions here by using the shadow classyou get both an object-based interface to +and customizable python object for instancethe python module shown in example - extends the +classadding an extra print call statement to the +add method and defining brand-new mul method because the shadow class is pure pythonthis works naturally example - pp \integrate\extend\swig\shadow\main_subclass py "sublass +class in python (generated shadow class)from number import number import shadow class class mynumber(number)def add(selfother)print('in python add 'number add(selfotherdef mul(selfother)print('in python mul 'self data self data other num mynumber( num add( num display(num sub( num display(extend method add new method same tests as main cxxmain py using python subclass of shadow class add(is specialized in python wrapping +classes with swig