- Define a switch that C extensions can check to determine whether the
init func should be called initbar or initfoo_bar (or something).
I'd rather have a set of macros that automatically do the right thing, but that's a minor detail. Changing the name of the init function is certainly doable.
But if the init function contains the complete package path (and I see no other way to avoid name clashes), then we have to worry about the limitations that various systems impose on the name of global symbols. I doubt that there are still many systems around that use only eight characters, but I think 32 is a common limit. Although I am not really sure about the current state of the art!
- change the DL import mechanism so the init function *has* to be called
initfoo_bar. But then, to remain backwards compatible you'd still have use a switch, so it doesn't help much now.
Backwards compatible with what? Currently builtin modules can't be in packages at all, so nothing's lost.