Linux.com: Programming with Python - Part 3: Extending PythonNov 19, 2000, 15:43 (0 Talkback[s])
(Other stories by Jason Tackaberry)
"The first two parts of this series gave you a pretty compelling shove into the world of Python. By now you have a firm grasp on Python fundamentals, and are in a good position to approach any project with Python."
"There is another side to Python that we haven't looked at yet, however. Two of Python's characteristics briefly mentioned in Part 1 were extensibility and embeddability. When a language (or any system, for that matter) is extensible, it means it can be modified to perform new tasks not part of the original system, or altered so that existing tasks function differently. If it is embeddable, it can be linked with a separate system to provide the functionality of one system to the other. In Python's case, it is typically embedded in an application in order to offer a scripting language as a convenient way to control the application's behaviour (an IRC scripting language, for example). In Part 3, we're going to look closely at Python's extensibility, and in particular the Python/C API. Once you have a firm grasp on the API, embedding Python is not a huge challenge...."
"All Python objects have a reference count. When an object is initialized, its reference count is set to 1. When other objects want to hold a reference to it (that object is added to a list, say), its reference count must be increased. When that other object no longer needs a reference, the reference count is decremented. When an object's reference count reaches 0, it is destroyed. This is reference counting in a nutshell."
0 Talkback[s] (click to add your comment)