[Pythonmac-SIG] appscript terminology caching

Jack Jansen Jack.Jansen at cwi.nl
Sat Oct 16 01:00:31 CEST 2004


On 15 Oct 2004, at 22:56, Bob Ippolito wrote:
>> Terminology resources belong to installed applications, not client 
>> scripts, so it wouldn't make sense to bundle it with the latter. 
>> (i.e. It's specific to a machine, not to a script.)
>
> I'm not sure I agree with this.  I'm pretty sure that compiled 
> applescripts do not depend on the terminology of the applications they 
> talk to, and I would imagine that the vast majority of applications 
> written in compiled languages that use AppleScript to talk to one 
> another do not parse terminologies before they start talking.

I agree with this (with Bob, that is). It would be very nice if we 
could have this same behaviour for Python. And while we can't in the 
general case, because there's no "compile step" for Python, it would be 
good to have it at least for py2app packaged programs.

I'm toying with an idea to abuse Python's import mechanism for this, 
something along the lines that when you need the terminology for MyApp 
you import MagicTerminologyGenerator.MyApp, and when 
MagicTerminologyGenerator/MyApp.pyc exists it'll be used automatically, 
but if it doesn't exist then the magic importer will create it (there's 
no MagicTerminologyGenerator/MyApp.py, that's somehow how the magic 
kicks in). But then you're storing the cached terminology in the 
MagicTerminologyGenerator package, and that's not really where you want 
it.

Hmm, could it be that if module foo.py uses the terminology for MyApp, 
and that terminology has not been created yet, you want the compiled 
terminology in the same place where you have foo.pyc?
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman



More information about the Pythonmac-SIG mailing list