日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:Function 對象

Function 對象

有一些特定于 python 函數(shù)的函數(shù)。

創(chuàng)新互聯(lián)專注于柳州企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站,商城網(wǎng)站定制開發(fā)。柳州網(wǎng)站建設(shè)公司,為柳州等地區(qū)提供建站服務(wù)。全流程按需定制開發(fā),專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

type PyFunctionObject

用于函數(shù)的 C 結(jié)構(gòu)體。

PyTypeObject PyFunction_Type

這是一個 PyTypeObject 實例并表示 Python 函數(shù)類型。 它作為 types.FunctionType 向 Python 程序員公開。

int PyFunction_Check(PyObject *o)

如果 o 是一個函數(shù)對象 (類型為 PyFunction_Type) 則返回真值。 形參必須不為 NULL。 此函數(shù)總是會成功執(zhí)行。

PyObject *PyFunction_New(PyObject *code, PyObject *globals)

Return value: New reference.

返回與代碼對象 code 關(guān)聯(lián)的新函數(shù)對象。 globals 必須是一個字典,該函數(shù)可以訪問全局變量。

The function’s docstring and name are retrieved from the code object. __module__ is retrieved from globals. The argument defaults, annotations and closure are set to NULL. __qualname__ is set to the same value as the code object’s co_qualname field.

PyObject *PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)

Return value: New reference.

As PyFunction_New(), but also allows setting the function object’s __qualname__ attribute. qualname should be a unicode object or NULL; if NULL, the __qualname__ attribute is set to the same value as the code object’s co_qualname field.

3.3 新版功能.

PyObject *PyFunction_GetCode(PyObject *op)

Return value: Borrowed reference.

返回與函數(shù)對象 op 關(guān)聯(lián)的代碼對象。

PyObject *PyFunction_GetGlobals(PyObject *op)

Return value: Borrowed reference.

返回與函數(shù)對象*op*相關(guān)聯(lián)的全局字典。

PyObject *PyFunction_GetModule(PyObject *op)

Return value: Borrowed reference.

向函數(shù)對象 op__module__ 屬性返回一個 borrowed reference。 該值可以為 NULL。

這通常為一個包含模塊名稱的字符串,但可以通過 Python 代碼設(shè)為任何其他對象。

PyObject *PyFunction_GetDefaults(PyObject *op)

Return value: Borrowed reference.

返回函數(shù)對象 op 的參數(shù)默認值。 這可以是一個參數(shù)元組或 NULL。

int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)

為函數(shù)對象 op 設(shè)置參數(shù)默認值。 defaults 必須為 Py_None 或一個元組。

失敗時引發(fā) SystemError 異常并返回 -1 。

PyObject *PyFunction_GetClosure(PyObject *op)

Return value: Borrowed reference.

返回關(guān)聯(lián)到函數(shù)對象 op 的閉包。 這可以是 NULL 或 cell 對象的元組。

int PyFunction_SetClosure(PyObject *op, PyObject *closure)

設(shè)置關(guān)聯(lián)到函數(shù)對象 op 的閉包。 closure 必須為 Py_None 或 cell 對象的元組。

失敗時引發(fā) SystemError 異常并返回 -1

PyObject *PyFunction_GetAnnotations(PyObject *op)

Return value: Borrowed reference.

返回函數(shù)對象 op 的標(biāo)注。 這可以是一個可變字典或 NULL。

int PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)

設(shè)置函數(shù)對象 op 的標(biāo)注。 annotations 必須為一個字典或 Py_None。

失敗時引發(fā) SystemError 異常并返回 -1 。


標(biāo)題名稱:創(chuàng)新互聯(lián)Python教程:Function 對象
瀏覽路徑:http://m.5511xx.com/article/cdoopes.html