num data print(num datanum display(num mul( num display(print(numdel num mul(is implemented in python repr from shadow superclass now we get extra messages out of add callsand mul changes the +class' data member automatically when it assigns self data--the python code extends the +code/pp /integrate/extend/swig/shadowpython main_subclass py number in python add add number= sub number= number= in python mul number= ~number in other wordsswig makes it easy to use +class libraries as base classes in your python scripts among other thingsthis allows us to leverage existing +class libraries in python scripts and optimize by coding parts of class hierarchies in +when needed we can do much the same with extension types today since types are classes (and vice versa)but wrapping +classes with swig is often much simpler exploring the wrappers interactively as usualyou can import the +class interactively to experiment with it some more-besides demonstrating few more salient properties herethis technique allows us to test wrapped +classes at the python interactive prompt/pp /integrate/extend/swig/shadowpython import _number _number __file__ the +class plus generated glue module '_number dllimport number the generated python shadow class module number __file__ 'number pyx number number( number number number( number python/ integration make +class instance in python make another +object