
We've just been having a discussion on the Cython list about implementing the __init__ file of a package as an extension module. It turns out that just putting an __init__.so file in a directory isn't enough to make Python recognise it as a package. However, if there is both an __init__.py and an __init__.so, it's recognised as a package, and the __init__.so gets loaded. So it's possible, but only by exploiting some undocumented and probably accidental behaviour. So how about officially recognising an __init__.so file as a package main file? -- Greg

This was a shortcut when we couldn't think of a reason why people would ever have a __init__.so. Feel free to submit a patch but keep in mind that there are probably a bunch of different places in tools (not necessarily under our control) that also make this check. Why not have an __init__.py that imports _initialize.so or something? On Thu, Oct 30, 2008 at 10:41 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
We've just been having a discussion on the Cython list about implementing the __init__ file of a package as an extension module.
It turns out that just putting an __init__.so file in a directory isn't enough to make Python recognise it as a package.
However, if there is both an __init__.py and an __init__.so, it's recognised as a package, and the __init__.so gets loaded. So it's possible, but only by exploiting some undocumented and probably accidental behaviour.
So how about officially recognising an __init__.so file as a package main file?
-- Greg _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Greg Ewing
-
Guido van Rossum