• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: python
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python


  • Subject: Re: python
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 9 Apr 2004 10:40:58 -0700

On Apr 8, 2004, at 2:48 PM, Emmanuel wrote:

set cmd to "print 'hello, world'"

chrono
repeat 100
do shell script "python -c " & quoted form of cmd
end
chrono
-- 10 seconds (G3/900MHz)

And your point is?

100 invocations of a subordinate shell and 100 initializations and invocations of Python will take time, no matter what 'cmd' is or how fast Python executes it.

Just a note that if you want to do something efficiently in a do shell script command, do as much as possible in one do shell script invocation (that is, write a shell script and execute it in toto with do shell script), rather than invoking do shell script repeatedly. This also allows you to retain state (such as working directory, environment variables, etc.) between shell commands.

AppleScript commands are modeless and stateless, so there's always a cost to executing them repeatedly.

Chris
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: python
      • From: Harald E Brandt <email@hidden>
References: 
 >python (From: roy whelden <email@hidden>)
 >Re: python (From: Christopher Nebel <email@hidden>)
 >Re: python (From: Emmanuel <email@hidden>)

  • Prev by Date: More iChat misbehavior
  • Next by Date: Black Text Overprinting in Quark 5
  • Previous by thread: Re: python
  • Next by thread: Re: python
  • Index(es):
    • Date
    • Thread