dojini 님의 블로그

  • 홈
  • 태그
  • 방명록

Python 2

[CPython] int 내부 구조 - Python 3.12

int의 자료구조는 Python 3.11까지는 PyVarObject의 형태였으나 Python 3.12 부터 PyObject로 변경되었다.이 글은 Python 3.13을 기준으로 제작되었다.PyLongObjectPyLongObject는 int 자료형의 구조체이다.// Include/cpython/longintrepr.h// line 93typedef struct _PyLongValue { uintptr_t lv_tag; /* Number of digits, sign and flags */ digit ob_digit[1];} _PyLongValue;// line 98struct _longobject { PyObject_HEAD _PyLongValue long_value;};_PyLong..

Python 2024.11.12

[Python] typing - Callable

CallableCallable은 Python에서 호출 가능한 객체의 표현 타입이다.객체가 호출 가능한지는 callable 함수를 통해 확인 할 수 있다.# Callable Oprint(callable(print))# Callable Xprint(callable(1))결과TrueFalse __call__객체를 호출하였을 경우 실핼되는 함수는 객체의 magic method인 __call__이다.객체의 call 함수는 객체의 type에 명시되어 있다.print(print.__class__.__dict__["__call__"])결과 CPython의 call과 callableCPython의 type objectstruct _typeobject { PyObject_VAR_HEAD ... ternar..

Python 2024.11.05
이전
1
다음
더보기
프로필사진

dojini 님의 블로그

dojini 님의 블로그 입니다.

  • 분류 전체보기 (7)
    • Test (0)
    • BOJ (5)
    • Python (2)

Tag

int, boj, Typing, 점프, TEST, callable, 테스트 주도 개발, TDD, cpython, python 3.12, 1890, Python,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/12   »
일 월 화 수 목 금 토
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바