>> display(number= add( dataadd display(number= call +method (like + ->display()fetch +data membercall +method data data data display(number= set +data member records the +this pointer square( square(ttype( ( method with return value type is class in python naturallythis example uses small +class to underscore the basicsbut even at this levelthe seamlessness of the python-to- +integration we get from swig is astonishing python code uses +members and methods as though they are python code moreoverthis integration transparency still applies once we step up to more realistic +class libraries so what' the catchnothing muchreallybut if you start using swig in earnestthe biggest downside may be that swig cannot handle every feature of +today if your classes use some esoteric +tools (and there are many)you may need to handcode simplified class type declarations for swig instead of running swig over the original class header files swig development is ongoingso you should consult the swig manuals and website for more details on these and other topics in return for any such trade-offsthoughswig can completely obviate the need to code glue layers to access and +libraries from python scripts if you have ever coded such layers by hand in the pastyou already know that this can be very big win if you do go the handcoded routethoughconsult python' standard extension manuals for more details on both api calls used in this as well as additional extension tools we don' have space to cover in this text extensions can run the gamut from short swig input files to code that is staunchly wedded to the internals of the python interpreteras rule of thumbthe former survives the ravages of time much better than the latter other extending tools in closing the extending topici should mention that there are alternatives to swigmany of which have loyal user base of their own this section briefly introduces some of the more popular tools in this domain todayas usualsearch the web for more other extending tools