Neil's News

+ 2010
+ 2009
+ 2008
+ 2007
+ 2006
+ 2005
- 2004
 Silence
 Snowflakes
 Paranoia Pays
 Microsoft Help
 Polyglot 11: More C
 Polyglot 11: C
 Polyglot 10: Smalltalk
 Toronto Wisdom
 Exterminated
 The Last Straw
 BT Broadband Trap
 Polyglot 9: Moo
 Polyglot 8: SVG
 Polyglot 7: POV-Ray
 Polyglot 6: Python
 Polyglot 5: PHP
 Polyglot 4: Euphoria
 Polyglot 3: JavaScript
 Polyglot 2: Java
 Polyglot 1: VB
 POV-Ray
 Etch A Sketch
 Slashdotting
 Flashy Lies
 Scientific Illiteracy
 Creeping Featurism
 VidScope
 Saturn V
 Perspectives
 Slide Rule
 eBay Sale
 Iron Filings
 Gimble
 VBA Security
 Random Morsels
 Exact Change
 Easter Egg
 Diametral Pitch
 mod_deflete
 Ethical Spam?
 Deadlines
 CPU Power
 Fosdem 2004
 Academic Reversal
 Mars Memorial
 Culture Clash
 Watching the Users
+ 2003
+ 2002

Polyglot 6: Python

18 September 2004

[Python] Sixth is Python. Good general-purpose language. If there isn't a language which specialises in the desired task (high-level = Lisp; speed = C; multiuser = Moo) then Python is usually a safe bet. The biggest downside is that when compared with other languages, the documentation is poorly organised and poorly written. The docs are so bad that the only way I could write this application was to disect the C source code. I'd argue that the 'Python Paradox'[?] is actually caused by everyone but the most determined programmers switching to lanugages which are properly documented.

Here's the Python source code and a running implementation of the standard colour program. Due to pathetic programming within the Python-GD interface, images are limited to a maximum of 256 colours. Worst implementation yet, and the one that took the longest to program too.

On an unrelated issue, let's play with fire:

Python
def maxrec():
  maxrec();
maxrec();
PHP
function maxrec(){ maxrec(); }
maxrec();
Perl
sub maxrec { maxrec(); }
maxrec();

What do they all do? Blow up, obviously. But how they do it is interesting.
Python (like the Moo) runs a bit then spits out a full traceback ending with "maximum recursion depth exceeded". Good. One can debug that.
PHP runs a bit then quits with "Segmentation fault" offering no clue what happened or where. This isn't ideal.
Perl (like Euphoria) runs and runs and runs. There's a giant sucking sound as memory disappears and all other applications on the server grind to a halt. Meanwhile the sysadmin is sweating bullets trying to kill the task before the server falls over.

[Richard, don't even think about it. I know where you live.]

< Previous | Next >

 
-------------------------------------