From: <and...@hi...> - 2006-05-24 14:53:12
|
Hi Consider the following simple interface file: %module append %{ class Test { public: Test() {}; }; %} %pythonappend Test::Test %{ # inserted statement print "Constructor" %} class Test { public: Test(); }; Compiled with Swig (V1.3.29 on Windows), using the command line: swig -python -c++ append.i produces the following output: class Test(_object): __swig_setmethods__ =3D {} __setattr__ =3D lambda self, name, value: _swig_setattr(self, Test, nam= e, value) __swig_getmethods__ =3D {} __getattr__ =3D lambda self, name: _swig_getattr(self, Test, name) __repr__ =3D _swig_repr def __init__(self, *args):=20 this =3D _append.new_Test(*args) try: self.this.append(this) except: self.this =3D this =20=20=20=20=20=20=20=20 # inserted statement print "Constructor" It seems that the original indentation of the append block is retained and = thus determines the scope of the included statement. Is this expected behav= iour? Regards Andreas Held http://pyfltk.sourceforge.net |