问题
In IronPython I can do:
Console.WriteLine(int.MaxValue)
where int is not a variable but rather System.Int32. I get back:
Max of int: 2137483647
Yet if I try something similar for double (System.Double), I get:
NameError: name 'double' is not defined.
Similary for char (System.Char). How come?
回答1:
See Mapping between Python builtin types and .NET types
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
.
double
and char
are not builtin types in Python.
来源:https://stackoverflow.com/questions/14276256/ironpython-double-keyword-not-recognised