理解Jim Fulton‘s Extension Classes

    技术2024-08-10  64

    Extension Building Tools

    A number of tools are available to simplify the construction of Python extensions

    Extension Classes

    Extension classes, written by Jim Fulton and available at http://www.digicool.com/releases/ExtensionClass/, provide a mechanism for defining extension types that are more class-like. In particular, they can be sunclassed in C or Python, and provide better interaction with documentation strings and other aspects of the interpreter.

    cxx
    pyfort
    Boost Python Library

    From Jim Fulton’s site

    ExtensionClass(github), a meta-class implementation for Python before Python had user-customizable meta classes.

    From github, ExtensionClass as a package provides a metaclass that allows classes implemented in extension modules to be subclassed in Python. Unless you need ExtensonClasses for legacy applications, you probably want to use Python’s new-style classes (available since 2.2).

    This package provides a way to attach attributes to an ExtensionClass or instance that are computed by calling a callable. This works very much like property known for new-style classes, except that a ComputedAttribute can also be attaced to an instance and that it honours ExtensionClass semantics.

    References

    Extension Classes, Python Extension Types Become Classes《Python Essential Reference》 P330Jim Fulton’s professional siteGithub : zopefoundation/ExtensionClassMetaclasses and Extension Classes (a.k.a. “The Killer Joke”)
    Processed: 0.011, SQL: 9