I have been playing around with Iron Python, and it’s a joy. Mostly it’s a joy because I don’t have to look at curly braces all day, but I can do a lot of the same stuff I could do with C#.
But I learned the hard way (and I guess I should’ve known) that:
is not the same as
from module import *
I was working on the example in ProIronPython (Apress) Chapter 5 (if you care to know), and was instructed to import the NotQuitePad.py module (page 102, bottom). So I tried using version 1 (above), and got an error upon building, more specifically an ArgumentType Exception in this line of NotQuitePad.py.
The message read: module object is not callable. – – – There is lots of information about importing modules in IronPython on this page here. But the real help came from the Python help pages: “Chapter 6.12 The import Statement“. Even if you don’t know much about modules, the error message leads you in the right direction. Turns out it’s all about namespaces.
The first form of import statement binds the module name in the local namespace to the module object… The from form does not bind the module name: it goes through the list of identifiers, looks each one of them up […], and binds the name in the local namespace to the object thus found.