Postgresql 中文操作指南
46.3. Sharing Data #
全局字典 SD 用于存储同一函数重复调用之间的私有数据。全局字典 GD 是公开数据,可供会话中的所有 Python 函数使用;请谨慎使用。
The global dictionary SD is available to store private data between repeated calls to the same function. The global dictionary GD is public data, that is available to all Python functions within a session; use with care.
每个函数在 Python 解释器中都有自己的执行环境,以便 myfunc 中的全局数据和函数参数不可用 myfunc2。上述特例是 GD 字典中的数据。
Each function gets its own execution environment in the Python interpreter, so that global data and function arguments from myfunc are not available to myfunc2. The exception is the data in the GD dictionary, as mentioned above.