scipy/weave/examples/increment_example.py
def build_increment_ext():
    """ Build a simple extension with functions that increment numbers.
        The extension will be built in the local directory.
    """
    mod = ext_tools.ext_module('increment_ext')

    # Effectively a type declaration for 'a' in the following functions.
    a = 1

    ext_code = "return_val = PyInt_FromLong(a+1);"
    func = ext_tools.ext_function('increment',ext_code,['a'])
    mod.add_function(func)

    ext_code = "return_val = PyInt_FromLong(a+2);"
    func = ext_tools.ext_function('increment_by_2',ext_code,['a'])
    mod.add_function(func)

    mod.compile()
 Build a simple extension with functions that increment numbers.
        The extension will be built in the local directory.
    
Build a simple extension with functions that increment numbers.
The extension will be built in the local directory.
Build a simple extension with functions that increment numbers . The extension will be built in the local directory .
def build_increment_ext():
    mod = ext_tools.ext_module('increment_ext')
    a = 1
    ext_code = "return_val = PyInt_FromLong(a+1);"
    func = ext_tools.ext_function('increment',ext_code,['a'])
    mod.add_function(func)
    ext_code = "return_val = PyInt_FromLong(a+2);"
    func = ext_tools.ext_function('increment_by_2',ext_code,['a'])
    mod.add_function(func)
    mod.compile()
def build_increment_ext ( ) : mod = ext_tools . ext_module ( 'increment_ext' ) a = 1 ext_code = "return_val = PyInt_FromLong(a+1);" func = ext_tools . ext_function ( 'increment' , ext_code , [ 'a' ] ) mod . add_function ( func ) ext_code = "return_val = PyInt_FromLong(a+2);" func = ext_tools . ext_function ( 'increment_by_2' , ext_code , [ 'a' ] ) mod . add_function ( func ) mod . compile ( )
Build a simple extension with functions that increment numbers.
Build a simple extension with functions that increment numbers .
""" Build a simple extension with functions that increment numbers.
        The extension will be built in the local directory.
    """ # Effectively a type declaration for 'a' in the following functions.