함수 객체
*********

파이썬 함수와 관련된 몇 가지 함수가 있습니다.

PyFunctionObject

   함수에 사용되는 C 구조체.

PyTypeObject PyFunction_Type

   이것은 "PyTypeObject"의 인스턴스이며 파이썬 함수 형을 나타냅니다.
   파이썬 프로그래머에게 "types.FunctionType"으로 노출됩니다.

int PyFunction_Check(PyObject *o)

   Return true if *o* is a function object (has type
   "PyFunction_Type"). The parameter must not be "NULL".

PyObject* PyFunction_New(PyObject *code, PyObject *globals)
    *Return value: New reference.*

   코드 객체 *code*와 연관된 새 함수 객체를 반환합니다. *globals*는 함
   수에서 액세스할 수 있는 전역 변수가 있는 딕셔너리이어야 합니다.

   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 function's name.

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 its "__name__" attribute.

   버전 3.3에 추가.

PyObject* PyFunction_GetCode(PyObject *op)
    *Return value: Borrowed reference.*

   함수 객체 *op*와 연관된 코드 객체를 반환합니다.

PyObject* PyFunction_GetGlobals(PyObject *op)
    *Return value: Borrowed reference.*

   함수 객체 *op*와 연관된 전역 딕셔너리를 반환합니다.

PyObject* PyFunction_GetModule(PyObject *op)
    *Return value: Borrowed reference.*

   함수 객체 *op*의 *__module__* 어트리뷰트를 반환합니다. 이것은 일반
   적으로 모듈 이름을 포함하는 문자열이지만, 파이썬 코드로 다른 객체로
   설정할 수 있습니다.

PyObject* PyFunction_GetDefaults(PyObject *op)
    *Return value: Borrowed reference.*

   Return the argument default values of the function object *op*.
   This can be a tuple of arguments or "NULL".

int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)

   Set the argument default values for the function object *op*.
   *defaults* must be "Py_None" or a tuple.

   실패하면 "SystemError"를 발생시키고 "-1"을 반환합니다.

PyObject* PyFunction_GetClosure(PyObject *op)
    *Return value: Borrowed reference.*

   Return the closure associated with the function object *op*. This
   can be "NULL" or a tuple of cell objects.

int PyFunction_SetClosure(PyObject *op, PyObject *closure)

   Set the closure associated with the function object *op*. *closure*
   must be "Py_None" or a tuple of cell objects.

   실패하면 "SystemError"를 발생시키고 "-1"을 반환합니다.

PyObject *PyFunction_GetAnnotations(PyObject *op)
    *Return value: Borrowed reference.*

   Return the annotations of the function object *op*. This can be a
   mutable dictionary or "NULL".

int PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)

   Set the annotations for the function object *op*. *annotations*
   must be a dictionary or "Py_None".

   실패하면 "SystemError"를 발생시키고 "-1"을 반환합니다.
