Jump to Navigation

Me on Twitter

  • After voice duplication, face generation. What cannot #deeplearning do? "This Person Does Not Exist" - https://t.co/oD3QHpoSbS 3 weeks 4 days ago
  • That's screen co-tenancy, towards Screen-As-A-Service ! https://t.co/RiokgK2iXt 4 weeks 3 days ago
  • Proof that Internet is a great thing : Mission: Impossible theme song [10 hours] - https://t.co/g4LJKpJvPM 4 weeks 6 days ago
  • RT @datagouvfr: Ce n’est pas tous les jours qu’on libère 15 millions de données. Demain (mercredi), venez explorer les données sur les tran… 12 weeks 2 days ago
  • @UlrichRozier Essaye la bouillie bordelaise. C'est bio. 12 weeks 4 days ago
  • RT @karesti: If you need some #chaosengineering experts feel free to reach me! #womenintech https://t.co/gCkAa2cW1Y 12 weeks 4 days ago
  • RT @martinfowler: Statement from Centro de Autonomía Digital on the arrest of @olabini. He has finally been been able to speak to lawyers.… 13 weeks 6 days ago
  • RT @alsacreations: Pure CSS Francine, une oeuvre dans le style d'une peinture du 18e siècle entièrement conçue à la main en HTML/CSS https:… 20 weeks 2 days ago
  • "Selon les services allemands de cybersécurité, Windows 10 vous surveille de 534 façons [...] et montre qu’à moins… https://t.co/t2qXSX6xt6 21 weeks 3 days ago
  • Stop saying, “We take your privacy and security seriously” - https://t.co/MippyEQMtx 21 weeks 4 days 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>
  • Vous pouvez activer la coloration syntaxique du code source à l'aide des balises suivantes: <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.