Jump to Navigation

Me on Twitter

  • @louistouzet @CedN plus de place pour scala. Je suis inscrit pour android ! 7 years 16 weeks ago
  • @louistouzet @twandroid @louistouzet excellent ! De quoi m'inciter a réinstaller #jellybean 7 years 16 weeks ago
  • Just noticed that I've started to drink coffee lately. Wonder why... #Scala 7 years 16 weeks ago
  • #Scala sometimes u just want 2 fix ur code a bit... and u just spend the rest of the evening figuring out how to get back the working code ! 7 years 16 weeks ago
  • RT @Etalab: Encore 1 MOIS pour concourir a #Dataconnexions 2. RDV sur http://t.co/bX6ino3d pour s' inscrire et faire gagner vos applic ... 7 years 17 weeks ago
  • RT @vogella: RT @w1bble The Lance Armstrong bug - when the code never fails a test, but evidence shows it's not behaving as it should. 7 years 17 weeks ago
  • @Viadeo : Un site web à la française http://t.co/AbcWAaQi 7 years 18 weeks ago
  • @agoncal spéciale dédicace à @IBM @IBM_AppServer #websphere 7 years 19 weeks ago
  • @rovio @badpiggies is a game that calls for sharing fun moments! It deserves in-game screenshot & video capture facilities... 7 years 19 weeks ago
  • Like crashing or not crashing... 7 years 19 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.


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.