2008-06-16

Major rewrite of import flowchart

While I was stuck waiting for my severely delayed flight from Vancouver to LA nearly two weeks ago, I spent my time in the airport rewriting the import flowchart that I created in Omnigraffle. It now contains proper support for __package__ as required by PEP 366. I also redesigned the API such that there would be a function call that is easier to use directly than the hoops most people jump through to use __import__() (you can all thank Jacob Kaplan-Moss for that since we were talking about providing a better API at PyCon 2008).

My hope for this flowchart, beyond helping me document import's semantics, is to have a visual representation of what is ridiculous about how import works. There is definitely some stuff in there that should just go or be changed to be more explicit. I think most of it can be deprecated safely such that transitioning, e.g. expecting __package__ to be defined for all modules, will be relatively painless for most users. I have a Google doc listing all the changes I want to make (there are currently five) in a priority order. Hopefully, once I get importlib finished and landed I can begin to tick things off the list so that Python 3.1 can have some nicer import mechanics.