IronPython is completly written using managed .net (c#) code. So all builtin
python methods and libraries (such as next()
, int()
, etc.) are writtin in .net.
This example shows the implementation of len()
for a list of different types (only a few):
....
public static int len([NotNull]List/*!*/ list) {
return list.__len__();
}
public static int len([NotNull]PythonTuple/*!*/ tuple) {
return tuple.__len__();
}
public static int len([NotNull]PythonDictionary/*!*/ dict) {
return dict.__len__();
}
....
If we would need some other type to count the length off, just add them in Builtin.cs
and it will be available automatically.