简体   繁体   English

python 的定义在 C 中是什么意思

[英]What def from python means in C

It may be a dumb question but what kind of data type is a def from Python in C?这可能是一个愚蠢的问题,但是 C 中 Python 的def是什么样的数据类型?

like int, uint32_t etc.. or nothing of all of this?像 int、uint32_t 等。还是什么都没有?

Thanks谢谢

def is a keyword in python. def是 python 中的关键字。 (It introduces the definition of functions.) It is not a datatype at all. (它介绍了函数的定义。)它根本不是一种数据类型。

def is the Python's keyword that is used at the start of the function/method definition. def是 Python 的关键字,用于函数/方法定义的开头。

C and Python are fundamentally different languages and doing a line by line translation is impossible. C 和 Python 是根本不同的语言,不可能逐行翻译。 To answer your direct question, def is a keyword in Python that only marks the start of a function declaration.要回答您的直接问题, def是 Python 中的关键字,仅标记 function 声明的开始。 There is no such keyword in C. C 中没有这样的关键字。 Sure, you need keywords to declare functions, but there is no single keyword that is required.当然,您需要关键字来声明函数,但不需要单个关键字。

Furthermore, you cannot compare types either.此外,您也无法比较类型。 C has a sh*tload of different types just for integers. C 具有仅用于整数的不同类型的 sh*tload。 Python3 only has one, and it has unlimited precision. Python3只有一个,而且精度无限。 Such a type does not exist in C, although there are libraries that provides the same functionality. C 中不存在这种类型,尽管有提供相同功能的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM