Jump to Navigation

Me on Twitter

  • #OMG ! I just realised there was SEVERAL apps on #GooglePlay to check the availability of the #nexus devices !! 11 years 8 weeks ago
  • "A quick brown fox jumped over the lazy dogs" is called a pangram because it has all the letters of the alphabet. http://t.co/wyzT5YcY9j 11 years 8 weeks ago
  • @apkudo Good tool, the GUI needs a good failure overview to make it really useful for developers : we need to identify the problematic cases 11 years 9 weeks ago
  • If you post a comment that contains an URL it will be *silently* ignored... #GooglePlay #android http://t.co/f7NPsr714f 11 years 9 weeks ago
  • @ippontech Etude bien utile pour débuter dans le dev #mobile. Certains pts gagneraient en clarté avec qques exemples http://t.co/hdA2990pg4 11 years 9 weeks ago
  • Last night I got #android 4.2.2 on my #nexus7 ! I'm getting accustomed to regular updates... It's not so bad... 11 years 10 weeks ago
  • Communication between Activity and Service using Messaging - #android by the example http://t.co/KlGqJBM3 11 years 10 weeks ago
  • RT @AskJamesApp: Pour en savoir plus sur moi http://t.co/cyFf1WPs #askjames 11 years 10 weeks ago
  • My #AngryBirds Score app for #android : https://t.co/RwQDfUqe. A very limited app compared to the one of @louistouzet but it helps ! 11 years 12 weeks ago
  • Just pushed a 277Mb commit to http://t.co/bJgdwBL9 in a couple of minutes : nice tool ! And it's free #bitbucket 11 years 12 weeks ago

Python versus Shell scripting : from experience

A quick "pros & cons" to choose between Python or Shell scripting, from what I've observed through the years.

This could probably apply to other high level script languages* vs shell.

* Like Ruby, but not like Perl, as it shares more with shells from my point of view, like unreadable syntax and execution speed.

Python vs Shell

Choose Python for :

  • its simple syntax : can be read even by non Python-speaking people. End users may not be scared to change scripts to fit their need.
  • portability : Python is actually more portable than shell because of ease of installation for any OS. Shell is theoretically portable but it's complicated to explain end users how to install the runtime (e.g. see cygwin). A Python script can be packaged into an executable program. There may be ways to bundle a script with the shell runtime.

Choose Shell for :

  • speed : except in case of bad code logic, shell scripts are usually a lot faster than Python's equivalents.
  • its ease to deal with external programs and system : shell's syntax is already made to test/pipe/chain easily existing programs, whereas Python requires some extra boilerplate. Shell also has built-in functions to deal directly with files and the system, whereas Python uses an object-oriented model, which may not be as handy.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>. The supported tag styles are: <foo>, [foo].
  • Twitter-style #hashtags are linked to search.twitter.com.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.