spyce
         
home     documentation     download     Spyce logo


Documentation - Modules

Prev: 3.8.11.2 - Stdout Up: 3.8.11 - Internal modules Next: 3.8.11.4 - Taglib

This module is used internally by Spyce, not usually by users. Documentation is included for those curious about Spyce internals. The spylambda module is loaded implicitly and allows the definition of functions based on Spyce scripts; see Spyce Lambdas. The spylambda module provides the following methods:
  • define( args, code, [memoize] ):
    Returns a function that accepts the given args and executes the Spyce script defined by the code parameter. Note that the code is compiled immediately and that spyce.spyceSyntaxError or spyce.spycePythonError exceptions can be thrown for invalid code arguments. The optional memoize parameter sets whether the spyce can or can not be memoized, with the default being false. Memoizing a function means capturing the result and output and caching them, keyed on the function parameters. Later, if a function is called again with the same parameters, the cached information is returned, if it exists, and the function may not actually be called. Thus, you should only memoize functions that are truly functional, i.e. they do not have side-effects: they only return a value and output data to the response object, and their behaviour depends exclusively on their parameters. If you memoize code that does have side-effects, those side-effects may not occur on every invocation.
  • __call__( args, code, _spyceCache ):
    This is an alias to the define function. Because of the special method name, the spylambda module object can be called as if it were a function.

Prev: 3.8.11.2 - Stdout Up: 3.8.11 - Internal modules Next: 3.8.11.4 - Taglib


Spyce logo
Python Server Pages
version 2.1.3
Spyce Powered SourceForge Logo