Custom Code Block

Zeev Hadar zeev at clockwise3d.com
Thu Jan 16 09:34:19 EST 2003


I would like to add my own custom code block as part of my python C++
extension.



I'm using Python 2.2 version as a script language for my engine and I have
wrote same python extensions in C++ for it.



I would like to add my own special code block that gives me control over the
execution:

For example - python code:



def MyFunc():

            x = 5

            MySpecialBlock:

                        x = x+1

                        print x

            print "func end"



Or alternatively:



def MyFunc(arg1):

            x = 5

            MySpecialBlock(arg1,arg2):

                        x = x+1

                        print x

            print "func end"



Where "MySpecialBlock" is coded in C++ as part of my python extension, and
gives me control over the execution of its following code block.



I need to execute some actions before and after running this code block and
control whether to run it or not at all.





Please direct me for how to achieve it in Python extension.



Regards Zeev Hadar






More information about the Python-list mailing list