I’d like to start out by disclaiming that I’m neither a Python person or a Perl person, I just thought that those who would be most interested in this post would get a kick out of the provocative title.
I’m one of those odd people who learned Scheme before doing any serious TCL, Perl, Python, Ruby etc. which gives me an interesting perspective on things. At CSR, Perl and Python are the only two languages permitted for internal (non-test related) script development.
For a new script I tried Python first. I quickly realised that the problem, which included some parsing, could elegantly be solved with mutual recursion.
I can’t disclose the code I wrote for my company so lets just use the old odd/even example to demonstrate.
As you’ve probably guessed, indeed Perl implements Tail Call Optimisation through the goto function.
As I stated earlier I’m not a big fan of either Python or Perl but I’m beginning to think that Perl is as least a bit fun.