On Sat, Feb 03, 2001 at 05:01:01PM -0600, Skip Montanaro wrote: > Tim> I'm afraid I find it hard to believe people will *keep* C-module > Tim> __all__ lists in synch with the code as the years go by. If we're > Tim> going to do this, how about adding code to Py_InitModule4 that > Tim> sucks the non-underscore names out of its PyMethodDef argument and > Tim> automagically builds an __all__ attr? Then nothing ever needs to > Tim> be fiddled by hand for C modules. > The way it works now is that the module author inserts a call to > _PyModuleCreateAllList at or near the end of the module's init func > /* initialize module's __all__ list */ > _PyModule_CreateAllList(d); Regardless of the use of this __all__ for C modules, this function has the wrong name. If it's intended a real part of the API (and it should be, if you want modules to use it) it shouldn't have a leading underscore. As for the debate on the usefulness, I don't care much either way -- I don't write or maintain that many C modules (exactly 0, in fact :-) and though I see the logic in placing the responsibility with the C module writers, I also know I greatly prefer writing and maintaining Python modules than C modules. Placing the responsibility in the (Python) module doing the 'from .. import *' sounds like a good enough idea to me. I'm also not sure what other examples of its use are out there, other than os.py. -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4