IronPython的:双关键字无法识别?双关、无法识别、IronPython

2023-09-06 16:29:12 作者:专属你的守护

在IronPython的,我可以做的:

In IronPython I can do:

Console.WriteLine(int.MaxValue)

其中的 INT 的是不是一个变量,而是System.Int32的。我得到的:

where int is not a variable but rather System.Int32. I get back:

Max of int: 2137483647

不过,如果我尝试类似的东西的双的(System.Double),我得到:

Yet if I try something similar for double (System.Double), I get:

NameError: name 'double' is not defined.

类似地进行的字符的(System.Char)。怎么会呢?

Similary for char (System.Char). How come?

推荐答案

请参阅 Python的内置类型和.NET类型之间的映射

INT 是不是一个关键字,它是一个内置式的Python和IronPython的实现它使用 System.Int32的。同样浮动使用实施 System.Double

int is not a keyword, it is a builtin type in Python, and IronPython implements it using System.Int32. Similarly float is implemented using System.Double.

字符不是内建类型Python编写的。

double and char are not builtin types in Python.