Thomas and Oren recently showed a couple of scripts in PowerShell and Boo respectively that count the number of types and methods in mscorlib.
Here is one possible implementation in IronPython ...
typeCount = methodCount = 0
mscorlib = System.Type.GetType('System.Object').Assembly
for t in mscorlib.GetTypes():
typeCount += 1
methodCount += t.GetMethods().Length
print "Types: %s | Methods: %s" % (typeCount, methodCount)
On my system (Vista) this script will output ...
Types: 2318 | Methods: 27677
I wonder, is there a more efficient way to implement this in IronPython?