This software summary covers ExtensionClass and its related packages, which provide a flexible and powerful way to create Python objects with customizable behaviors and attributes. ExtensionClass is designed to enhance the functionality of Python by allowing users to define their own classes and methods while still maintaining compatibility with existing Python code.
If you require the ability to subclass these types in Python, ExtensionClass is an ideal solution. However, if you're working with Python 2.2 or later, you may prefer to use the newer style classes available in the language.
In addition to the base ExtensionClass metaclass, this package also includes two powerful companion modules: ComputedAttribute and MethodObject.
ComputedAttribute provides an intuitive way to attach attributes to either an ExtensionClass or an instance of that class. These attributes are computed using a callable, much like the property attribute in new-style classes. However, ComputedAttribute has the added advantage of being able to attach to an instance of an ExtensionClass, and is fully aware of ExtensionClass semantics.
MethodObject is a second companion module that allows you to attach additional methods to ExtensionClasses. These methods are implemented by subclassing the MethodObject.Method class and implementing the __call__ method within. MethodObject.Method instances are tightly bound to the instance of the ExtensionClass they're attached to, receiving that instance object as the first parameter after self.
Overall, ExtensionClass provides a powerful and flexible metaclass for creating and subclassing extension types. Whether you're working with legacy code or looking to extend Python classes, ExtensionClass can offer a powerful solution to your needs.
Version 2.11.3: N/A