views:

404

answers:

11

Someone told me once, that programmers tend to learn one scripting language properly and ignore or dislike other scripting languages. Do you have similar experiences? I'm using Python as my choice for scripting for few years, however, I'm sure that there are many existing and emerging languages that could impress the Pythonistas. Can you recommend scripting languages that would be interesting and useful to learn besides of Python?

+4  A: 

I would recommend learning Haskell and a dialect of Lisp such as Scheme or Common Lisp, if you master either of those you'll gain insight into how things are accomplished with the functional paradigm and it'll help out your Python as well.

Here are some languages categorized by paradigms I'd learn:

Imperative/Procedural languages:

  • C

Functional paradigm languages:

  • Haskell
  • Common Lisp/Scheme

Similar object oriented languages:

  • Ruby
  • ECMAScript

Other:

  • Perl

I would advise you to stay away from PHP unless you really need the work. You would probably want to run back to Python.

meder
Yeah this is good. Crossing paradigms is more useful in the short term.
Matt Joiner
C isn't really a scripting language; typically when people say "scripting language", they mean a language that is interpreted, that has dynamic typing, and has a quick development and testing cycle.
Michael Aaron Safyan
@Michael - sure but I still recommend learning it.
meder
Definitely agree with the PHP remark.
Jesse Dhillon
+1  A: 

Ruby/Groovy/Perl if you'd like to stick to traditional scripting practices.

Otherwise I'd heartily recommend you Clojure and Scala - two of the more innovative programing languages of the past few years.

Bozhidar Batsov
+3  A: 

I'll give an honest answer from my perspective.

No.

Having started scripting using batch, bash, and Perl, discovering Python was discovering precisely what I'd want from a scripting language (and more, but that's off topic). It integrates with familiar Unix interfaces, is modular, doesn't force any particular paradigm, cross platform and under active development. The same can be said of no other scripting language I know of.

The only other scripting languages I'd consider using is Lua or Scheme, for their smaller footprints and suitability for embedding, Python can be a little hefty. However they're hardly suitable for the more general purpose shell and other forms of scripting.

Update0

I just noticed mentions of Ruby and PHP in other answers, these both slipped my mind, because I'd never consider using them. Ruby is slower and not quite as popular, and PHP is more C/Perl like, with flatter interfaces, which comes with performance boons of its own. Using these alternatives to Python is a matter of taste.

Matt Joiner
I disagree entirely with Matt - not because I don't think Python offers a hell of a lot (and I use it extensively), but you can always broaden your mind by reaching and reading into other languages and learning how they accomplish solutions to similar problems.
heckj
@heckj, I agree, but only with respect to DSLs, or application languages. The last thing we need is more scripting languages, many of them already painfully archaic/legacy, and littering the cores of our OSs.
Matt Joiner
Agreed. Ruby was around for ages and was pretty much only suitable for BSD ports configuration until DHH decided he wanted to pick the most anti-Java language he could to thumb his nose at J2EE.
Jesse Dhillon
Unrelated: "You recognise a programmer when he starts lists with a 0."
Kevin van Zanten
+6  A: 
  • Ruby - what it enables and does with blocks is really interesting, and quite foreign to python based programming

  • Erlang - the functional language has a lot of interesting examples and it will definitely make your head work differently afterwards (in a good way)

  • Javascript - yes, I'm serious. ALthough there's a fair number of grips to be had with this prototype language, it does some really interesting things with that prototyping and just slightly differently than Ruby and/or Python. And a ton of folks are pouring big money into making Javascript a outstandingly fast scripting language.

heckj
+1  A: 

If you are already familiar with Python, you are unlikely to find something compelling in the same niche, although Ruby does have a very strong and vocal following that seems to like it very much. Perhaps you should consider a scripting language that fills a different role, such as BASH shell script for quick, simple scripts that don't need the complexity of Python or JavaScript which runs in the browser.

Michael Aaron Safyan
+16  A: 

Look, Python pretty much has all you need (in my opinion) for application programming. You can write anything from a protocol stack to YouTube, from media players to 3D games and graphics and you get excellent performance.

It occupies the same niche as some of these other mentioned languages:

  • C, you have access to almost all of the useful C/C++ libraries. The only reason I would pick to write something in C over Python is because I needed the performance gain. Even then, I would probably prototype it in Python first; it's much easier to revise your design when your application is written in Python.

  • Ruby, there is no good reason to ever use Ruby instead of Python.

  • Perl, it's great for some particular kinds of tasks, but if you're a fan of consistent, readable and sane programming styles you will hate looking at about 95% of existing Perl code. I don't know if this is because the people who program in Perl tend to be (in my experience) sys admins first and programmers second, or because Perl has a design philosophy that allows for multiple distinct ways to achieve the same effect.

Given that, I would say that if you are going to learn another language, make sure it gives you the ability to do something new. There are two scripting languages that I would recommend for you to learn:

  • Bash, what a joy it is to manipulate your filesystem with a combination of for loops and pipes. Bash programming doesn't give you more than what you can already do with Python, but if you are a *nix user you will experience great gains in your daily productivity.

  • Javascript, being able to write browser-based applications is a useful skill and almost definitely the way most applications will be done in the future. The Javascript/browser environment is set to gain a whole host of capabilities in the coming few years, from audio manipulation to OpenGL graphics, and some very fast engines are either in the works or already available (like V8, which powers the Chrome browser and compiles Javascript to native byte code.) Have you seen Quake2 ported to WebGL?

My answer basically boils down to this: first, learn languages that are useful.

Jesse Dhillon
Seconded. If you already know Python, there's no point learning other languages that have very similar use cases. If you use *nix Bash is useful. if you do web programming Javascript is handy. If you play WoW^H^H^H^H^H^H^H^H need an embedded langauge Lua might be worth a look.
Simon Hibbs
+1 Woohoo! It would seem your answer is a bit friendlier than mine, and contains extra justification. I completely agree with all your recommendations.
Matt Joiner
+1 for the exposing the ugly truth of perl.
aaronasterling
+2  A: 

To answer your first question: Do people learn one language and then ignore or dislike others? Well, if you know one language well, you will need to see great advantages to move to another.

I started out using perl and eventually thought that there must be easier way to do some things. I picked up python and stopped using perl almost at once. A little while later I thought I'd try ruby and learned a bit about that. The advantages over using python weren't big enough to switch, so I decided to stick with python. If I had started out using ruby, I'd probably be using that still. If you are using python, I don't think you will easily find another scripting language that will win you over.

On the other hand, if you learn functional programming, you will probably learn a few new things, some of them will even be useful in your python programming, since a few things in python seems to be inspired by functional programming and knowing how to use them will make you a better programmer in general and a better python programmer too.

Mattias Nilsson
I think the little bit that I've learned of Lisp has made me a better programmer in general. Of course what I've learned in assembly and C(++) has also made me a better programmer. Heck, even learning Java has made me a better programmer (because I learned from its bad example ;)
Wayne Werner
+3  A: 

The only relatively unbiased answer you can really look for is probably statistical, and you would still have to account for the natural tendency of people to follow the path of least resistance once one is found or carved.

How many people learnt Python to a decent level, found the language resonates with the way they want to work, then move to something else because the language or the ecosystem, or both, don't support their needs? I'd say probably a single digit percentage of the educated userbase, wouldn't be surprised if it amounted to less than 5%.

Unless you have work related prospects that involve a different language, or you need to move sideways for similar reasons, I'd say you're probably best off learning something complimentary to Python rather than similar or equivalent. C++ for low-level or computationally intensive tasks, CUDA if your field can take advantage of it (med-viz, CGI etc.), whatever flavour of shell/sysadmin oriented scripting and hacks float where you work (bash, tcl, awk or whatever else) and so on.

Personally the reason I haven't bothered past a first glance with ruby, php, or a number of other languages is simply that it's better ROI to keep working on my python skills than picking up something that offers mostly the same qualities just in different forms.

If you really want to learn something else for the sake of opening your mind up a bit, and want to stick to "scripting", then LUA was an interesting toy for me for a while, mostly for the ridiculous performance you can squeeze out of a relatively easy integration process, and because it is a rather different set of tracks compared to Python. That, and the fact WoW plugins had to be written in LUA ;)

ThE_JacO
+4  A: 

Scripting languages are so similar that the marginal benefit of moving from one scripting language to another is usually low. So it's unsurprising that people wouldn't bother to learn more than one. Nevertheless, in my career I have passed through times when my main scripting language (in roughly chronological order) was

  • Awk
  • Tcl
  • Icon
  • Ksh
  • Lua

I also used Perl and Python but never found them enough better to be worth switching to.

If you want to check out another scripting language, I recommend Lua, because

  • It's powerful and remarkably simple, having the best power-to-weight ratio of all languages named here.

  • Like Tcl it was designed from the beginning to incorporate C code seamlessly. This facility works extremely well and greatly extends the range of problems for which it is useful (see Adobe Lightroom, World of Warcraft, Garry's Mod, CHDK).

  • The implementation is highly performant and brilliantly engineered. If you want to learn something about how languages are implemented, it will repay careful study.

If, however, your goal is to learn a new language to expand your mind, learn something else besides a scripting language. For example, learn Haskell and pick up some mind-blowing ideas (many stolen from the same sources that Guido stole from), or learn C and really understand exactly what's happening on the hardware.

Norman Ramsey
I think any functional language (Lisp/Scheme, etc.) creates mind blowing ideas when you come from imperative and OOP. Python allows you to program functionally, of course, but functional programming really changes how you think about programming.
Wayne Werner
+1  A: 

I'm actually learning Scala after Python. From "Programming in Scala":

The name Scala stands for “scalable language.” The language is so named because it was designed to grow with the demands of its users. You can apply Scala to a wide range of programming tasks, from writing small scripts to building large systems.

Integration of object-oriented and functional programming inside the language with expressive strong static type system is interesting by itself. And yes, you can use Scala as scripting language. I feel uncomfortable coding in languages with dynamic typing discipline so Scala seems to be a good alternative. Besides its complexity at the initial learning stage.

If you satisfied with dynamic typing discipline take a look at the roots. Smalltalkof course. Try Squeak with Squeak by Example companion book or its open-source fork Pharo with Pharo by Example book for the start.

kemiisto
+1  A: 

Learn a Lisp. Whether it's "scripting" or not, Eric Raymond had the right of it when he wrote:

"Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot."

The programming paradigm needed to be highly effective in Lisp is sufficiently unlike what you use with Python day-to-day that the perspective it gives is very, very much worth it.

And within Lisps, my choice? Clojure; like other Lisps, its macro system gives you capabilities comparable (actually superior) to the excellent metaprogramming in Python, but Clojure in particular has a focus on batteries-included practicality (and an intelligent, opinionated design) which will be familiar to anyone fond of GvR's instincts. Moreover, Clojure's strengths are extremely disjoint from Python's -- in particular, it shines at highly-multithreaded, CPU-bound concurrent programming, which is one of Python's weaknesses -- so having both in your toolbox increases the chance you'll have the right tool when a tricky job comes along.

(Is it scripting? In my view, that's pretty academic these days; if you have a REPL where you can type code and get an immediate response, modify the state of a running program, or experiment with an API, I see a language as "scripting" enough).

Charles Duffy