Re: minimum function?
Re: minimum function?
- Subject: Re: minimum function?
- From: Martin Orpen <email@hidden>
- Date: Wed, 06 Apr 2005 23:36:42 +0100
on 6/4/05 23:00, has at email@hidden wrote:
> Hey, if you're going to get snooty at other folk, it's helps to know exactly
> what you're talking about yourself.:p
I'd prefer the accusation of *talking out of your arse* to *being snooty*!
[snip]
>> I did try leaching a Python function later:
>>
>> do shell script "python -c 'y=min([" & x & "]); print y'"
>>
>> But that was slower than using sort (though faster than the previous
>> scripts.
>
> Pointless, since Python's min() function is no more efficient than the
> properly-optimised AS routine, plus you get an even bigger startup overhead as
> you're now starting a python interpreter process on top of a shell process.
> The 'do shell script' command is a very suboptimal solution for these sorts of
> problems.
Yeah, I know. I just thought I'd let you know that I was clutching at
straws.
> As a rule: if you're dealing with medium-to-large or unknown-size lists in
> AppleScript, always use the script object kludge (it's not worth it for small
> lists though). The problem has been known for years and discussed regularly
> here and elsewhere, so you'd think folk'd just apply this rule automatically
> by now, but there you go. (Actually, you'd think Apple and/or third-parties
> would've had the sense to create libraries containing all these basic
> functions years ago and render 95% of these discussions completely moot, but
> that's another story...)
That was the real kicker - the Groundhog Day moment that I mentioned - ISTR
discussing the very same routine with Nigel both on and off-list at some
point in the past. I'd forgotten something very useful...
--
Martin Orpen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden