Re: [Pyobjc-dev] NSApplicationMain idiom: wish to standardize
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-03-22 19:04:50
|
On Saturday, Mar 22, 2003, at 19:36 Europe/Amsterdam, Just van Rossum wrote: > Ronald Oussoren wrote: > >> That doesn't mean I'm not interested in speeding up PyObjC. I'm not >> much into import hacks, so how would one cause the creation of a >> custom module-like object when doing 'import AppKit'? Does this >> entrail creating an importhook, or is replacing sys.modules['AppKit'] >> from inside AppKit/__init__.py sufficient? > > The latter is sufficient. Supporting __getattr__ and having an __all__ > attribute is all that's needed, if I recall correctly. For a package > directory it should have a __path__ attribute. Interesting, that's pretty easy. I'm going to experiment with this. I'm going to target two things: 1. Speedier initialisation 2. Make the NSApp global variable available as a variable instead of a function I foresee one problem: Dynamicly adding the class names in AppKit to the __all__ list of the AppKit module/package. The only method I can come up with right now is about as expensive as the current code, which is not very usefull. We could depricate 'from AppKit import *', but that doesn't make me much happier. The other alternative is staticly filling __all__ (possibly based on the OS version). Ronald |