Ian Bicking: the old part of his blog

Comment

Sorry, but I think the "import foo == 2.0" is possibly the ugliest idea I've ever seen. Should I parse that as (import (foo == 2.0)) or ((import foo) == 2.0)? One way, you should be getting a NameError, and even if you didn't, now modules evaluate to FLOATS? The other way, 'import' becomes some new half-statement-half-expression monster that should be frankly be drowned at birth.

One of the real problems, I think, is exactly how the module versioning would work. Are we importing each possible matching modules one at a time until we find the one with the right version? That could get expensive, and lord help us if any of those modules have complicated initialization code.

Maybe we'd be better off extending the bytecode to make it easier to pull out a '__version__' variable without importing, and just extending the 'imp' module with a 'find_all_modules' function which returns a list of matching modules we can pick at the bytecode of.

Comment on Versioned Imports
by t e whalen