Jump to Navigation

Me on Twitter

  • @twandroid #TinyTinyRss Défaut : s'installe sur votre propre hébergement. Avantage : s'installe sur votre propre hébergement. #OpenSource 11 years 22 weeks ago
  • Google Drive Linux Petition Now 10k Signatures Strong, Google Yet to Respond http://t.co/tJLY5KkkLi via @omgubuntu 11 years 22 weeks ago
  • I've found my new #GoogleReader : #TinyTinyRss http://t.co/0WFXlu6rRg. It has a very good #Android client. It's #OpenSource ! 11 years 22 weeks ago
  • @wadael I'm not at #droidcon Will you release the slides soon ? @am_technix 11 years 24 weeks ago
  • Forgot about that : you can't use \u000D in a String in #Java because the compiler parses it early... http://t.co/a0eL1WpgvT 11 years 26 weeks ago
  • Some #CSS3 transitions, a little bit of Javascript and you've got a nice Feedback button http://t.co/SVEbCAmq81 11 years 27 weeks ago
  • #angrybirdsScore I am definitely NOT an artist #absync http://t.co/qqTQ6mXB3k 11 years 27 weeks ago
  • #android Loaders : forceLoad or not ? Answer is : sometimes YES, sometimes NO. #NoClue http://t.co/8Po1SfDGuS 11 years 27 weeks ago
  • Never update #android sdk if ur not sure 2 be able 2 update ADT right after or u'll be stuck in #eclipse... Maybe I've 2 look at #intellij 11 years 27 weeks ago
  • Hey ! I have 2 #nexus7 ! http://t.co/SKxHWycW6x 11 years 28 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>
  • 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.