What is a PyObject in Python?

前端 未结 2 1216
醉话见心
醉话见心 2021-01-17 07:30

Short version

I recently came across some Python code in which the return type for a function was specified as PyObject in the document

相关标签:
2条回答
  • 2021-01-17 07:49

    A PyObject is in fact just a Python object at the C level. And since integers in Python are objects, they are also PyObjects. It doesn't matter whether it was written in Python or in C, it is a PyObject at the C level regardless.

    0 讨论(0)
  • 2021-01-17 07:51

    Every value you can touch in Python is a PyObject in C. That includes lists, dictionaries, sockets, files, integers, strings, functions, classes, you name it. If you can touch it in Python, it’s a PyObject in C.

    0 讨论(0)
提交回复
热议问题