튜플 객체
*********

PyTupleObject

   이 "PyObject"의 서브 형은 파이썬 튜플 객체를 나타냅니다.

PyTypeObject PyTuple_Type

   이 "PyTypeObject" 인스턴스는 파이썬 튜플 형을 나타냅니다. 파이썬 계
   층의 "tuple"과 같은 객체입니다.

int PyTuple_Check(PyObject *p)

   *p*가 튜플 객체이거나 튜플 형의 서브 형의 인스턴스면 참을 돌려줍니
   다.

int PyTuple_CheckExact(PyObject *p)

   *p*가 튜플 객체이지만, 튜플 형의 서브 형의 인스턴스는 아니면 참을
   돌려줍니다.

PyObject* PyTuple_New(Py_ssize_t len)
    *Return value: New reference.*

   Return a new tuple object of size *len*, or "NULL" on failure.

PyObject* PyTuple_Pack(Py_ssize_t n, ...)
    *Return value: New reference.*

   Return a new tuple object of size *n*, or "NULL" on failure. The
   tuple values are initialized to the subsequent *n* C arguments
   pointing to Python objects. "PyTuple_Pack(2, a, b)" is equivalent
   to "Py_BuildValue("(OO)", a, b)".

Py_ssize_t PyTuple_Size(PyObject *p)

   튜플 객체에 대한 포인터를 받아서, 해당 튜플의 크기를 반환합니다.

Py_ssize_t PyTuple_GET_SIZE(PyObject *p)

   Return the size of the tuple *p*, which must be non-"NULL" and
   point to a tuple; no error checking is performed.

PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
    *Return value: Borrowed reference.*

   Return the object at position *pos* in the tuple pointed to by *p*.
   If *pos* is out of bounds, return "NULL" and set an "IndexError"
   exception.

PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
    *Return value: Borrowed reference.*

   "PyTuple_GetItem()"와 비슷하지만, 인자를 확인하지 않습니다.

PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high)
    *Return value: New reference.*

   Return the slice of the tuple pointed to by *p* between *low* and
   *high*, or "NULL" on failure.  This is the equivalent of the Python
   expression "p[low:high]".  Indexing from the end of the list is not
   supported.

int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)

   Insert a reference to object *o* at position *pos* of the tuple
   pointed to by *p*.  Return "0" on success.  If *pos* is out of
   bounds, return "-1" and set an "IndexError" exception.

   참고:

     This function "steals" a reference to *o* and discards a
     reference to an item already in the tuple at the affected
     position.

void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o)

   "PyTuple_SetItem()"과 비슷하지만, 에러 검사는 하지 않으며 새로운 튜
   플을 채울 때*만* 사용해야 합니다.

   참고:

     This macro "steals" a reference to *o*, and, unlike
     "PyTuple_SetItem()", does *not* discard a reference to any item
     that is being replaced; any reference in the tuple at position
     *pos* will be leaked.

int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)

   Can be used to resize a tuple.  *newsize* will be the new length of
   the tuple. Because tuples are *supposed* to be immutable, this
   should only be used if there is only one reference to the object.
   Do *not* use this if the tuple may already be known to some other
   part of the code.  The tuple will always grow or shrink at the end.
   Think of this as destroying the old tuple and creating a new one,
   only more efficiently.  Returns "0" on success. Client code should
   never assume that the resulting value of "*p" will be the same as
   before calling this function. If the object referenced by "*p" is
   replaced, the original "*p" is destroyed.  On failure, returns "-1"
   and sets "*p" to "NULL", and raises "MemoryError" or "SystemError".

int PyTuple_ClearFreeList()

   자유 목록(free list)을 지웁니다. 해제된 총 항목 수를 반환합니다.


구조체 시퀀스 객체
******************

구조체 시퀀스(struct sequence) 객체는 "namedtuple()" 객체의 C 등가물입
니다, 즉 어트리뷰트를 통해 항목에 액세스할 수 있는 시퀀스입니다. 구조
체 시퀀스를 만들려면, 먼저 특정 구조체 시퀀스 형을 만들어야 합니다.

PyTypeObject* PyStructSequence_NewType(PyStructSequence_Desc *desc)
    *Return value: New reference.*

   아래에 설명된 *desc*의 데이터로 새로운 구조체 시퀀스 형을 만듭니다.
   결과 형의 인스턴스는 "PyStructSequence_New()"로 만들 수 있습니다.

void PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)

   *desc*로 구조체 시퀀스 형 *type*을 재자리에서 초기화합니다.

int PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)

   "PyStructSequence_InitType"와 같지만, 성공하면 "0"을, 실패하면 "-1"
   을 반환합니다.

   버전 3.4에 추가.

PyStructSequence_Desc

   만들 구조체 시퀀스 형의 메타 정보를 포함합니다.

   +---------------------+--------------------------------+----------------------------------------+
   | 필드                | C 형                           | 의미                                   |
   |=====================|================================|========================================|
   | "name"              | "const char *"                 | 구조체 시퀀스 형의 이름                |
   +---------------------+--------------------------------+----------------------------------------+
   | "doc"               | "const char *"                 | pointer to docstring for the type or   |
   |                     |                                | "NULL" to omit                         |
   +---------------------+--------------------------------+----------------------------------------+
   | "fields"            | "PyStructSequence_Field *"     | pointer to "NULL"-terminated array     |
   |                     |                                | with field names of the new type       |
   +---------------------+--------------------------------+----------------------------------------+
   | "n_in_sequence"     | "int"                          | 파이썬 측에서 볼 수 있는 필드 수 (튜플 |
   |                     |                                | 로 사용된 경우)                        |
   +---------------------+--------------------------------+----------------------------------------+

PyStructSequence_Field

   구조체 시퀀스의 필드를 기술합니다. 구조체 시퀀스는 튜플로 모형화되
   므로, 모든 필드는 "PyObject*" 형을 취합니다.
   "PyStructSequence_Desc"의 "fields" 배열의 인덱스는 구조체 시퀀스의
   어떤 필드가 기술되는지를 결정합니다.

   +-------------+--------------------+-------------------------------------------+
   | 필드        | C 형               | 의미                                      |
   |=============|====================|===========================================|
   | "name"      | "const char *"     | name for the field or "NULL" to end the   |
   |             |                    | list of named fields, set to              |
   |             |                    | "PyStructSequence_UnnamedField" to leave  |
   |             |                    | unnamed                                   |
   +-------------+--------------------+-------------------------------------------+
   | "doc"       | "const char *"     | field docstring or "NULL" to omit         |
   +-------------+--------------------+-------------------------------------------+

char* PyStructSequence_UnnamedField

   이름 없는 상태로 남겨두기 위한 필드 이름의 특수 값.

PyObject* PyStructSequence_New(PyTypeObject *type)
    *Return value: New reference.*

   "PyStructSequence_NewType()"으로 만든 *type*의 인스턴스를 만듭니다.

PyObject* PyStructSequence_GetItem(PyObject *p, Py_ssize_t pos)
    *Return value: Borrowed reference.*

   *p*가 가리키는 구조체 시퀀스의 위치 *pos*에 있는 객체를 돌려줍니다.
   범위 검사가 수행되지 않습니다.

PyObject* PyStructSequence_GET_ITEM(PyObject *p, Py_ssize_t pos)
    *Return value: Borrowed reference.*

   "PyStructSequence_GetItem()"과 동등한 매크로.

void PyStructSequence_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)

   구조체 시퀀스 *p*의 인덱스 *pos*에 있는 필드를 값 *o*로 설정합니다.
   "PyTuple_SET_ITEM()"과 마찬가지로, 이것은 새로운 인스턴스를 채울 때
   만 사용해야 합니다.

   참고:

     이 함수는 *o*에 대한 참조를 "훔칩니다".

void PyStructSequence_SET_ITEM(PyObject *p, Py_ssize_t *pos, PyObject *o)

   "PyStructSequence_SetItem()"과 동등한 매크로.

   참고:

     이 함수는 *o*에 대한 참조를 "훔칩니다".
