
Jan. 17, 2016
9:54 p.m.
Concerning ways to allow a module to opt in to transformations that change semantics, my first thought was to use an import from a magic module: from __extensions__ import modulename This would have to appear before any other statements or non-magic imports, like __future__ does. The named module would be imported at compile time and some suitable convention used to extract transformers from it. The problem is that if your extension is in a package, you want to be able to write from __extensions__ import packagename.modulename which is not valid syntax. So instead of a magic module, maybe a magic namespace package: import __extensions__.packagename.modulename -- Greg