python codea system can be modified without shipping or building its full source code for instancesome programs provide python customization layer that can be used to modify the program on site by modifying python code embedding is also sometimes used to route events to python-coded callback handlers python gui toolkitsfor exampleusually employ embedding in some fashion to dispatch user events figure - sketches this traditional dual-mode integration model in extendingcontrol passes from python through glue layer on its way to code in embeddingc code processes python objects and runs python code by calling python api functions because python is "on topin extendingit defines fixed integration structurewhich can be automated with tools such as swig-- code generator we'll meet in this which produces glue code required to wrap and +libraries because python is subordinate in embeddingit instead provides set of api tools which programs employ as needed figure - traditional integration model in some modelsthings are not as clear-cut for exampleunder the ctypes module discussed laterpython scripts make library calls rather than employing glue code in systems such as cython (and its pyrex predecessor)things are more different still- libraries are produced from combinations of python and code and in jython and ironpythonthe model is similarbut java and ccomponents replace the languageand the integration is largely automated we will meet such alternative systems later in this for nowour focus is on traditional python/ integration models this introduces extending firstand then moves on to explore the basics of embedding although we will study these topics in isolationkeep in mind that many systems combine the two techniques for instanceembedded python code run from can also import and call linked-in extensions to interface with the enclosing application and in callback-based systemsc libraries initially accessed through extending interfaces may later use embedding techniques to run python callback handlers on events " am lost at