The answer to “Why Not Python?”

Collin Park has written an article in four parts (one, two, three, and four) titled “Why Not Python?”. I’ve read through the first couple of parts and scrolled through the rest.

In all that text that passed in front of my eyes I haven’t found the answer to the question. I guess, it wasn’t actually the question after all then.

Well, in case you read asked yourself “Why Not Python?”, I’ll give one of the possible answers. Because it is too complicated. Python might do OK as the first progarmming language for those of you who want to learn programming concepts. But if you have a problem at hand that needs solving, Perl is the way to go in most of the cases.

Example. Collin Park uses the Sudoku game solver as one of the examples. Fine task. Nice one to learn how to program too. But if you just have a Sudoku game to solve (or a few for that matter), than it would be much faster to do it in Perl. Here is how.

  1. Navigate your browser to search.cpan.org.
  2. Type in “sudoku”, choose “Modules” and press “Search CPAN”.
  3. With this particular example, any module from the search result can be used. With other examples, you want really want to review the module description (one line that says what module does). So, this step is, choose the one module that seems to be appropriate for your problem.
  4. Install chosen module, by running cpan command from root shell and typing in install module::name (substitute “module::name” with the name of the module you chose in the previous step).
  5. Run perldoc module::name to see module documentation and example of used.
  6. Copy the code from SYNOPSIS are of documentation in your favourite editor.
  7. Save the file
  8. Run the script

Tada! You’re all done.

If it takes you more than 15 minutes, chances are – you are doing something wrong. Of course, your mileage may vary, but 15 minutes is somewhere near the lighthouse.

4 thoughts on “The answer to “Why Not Python?””


  1. Come on, be serious! The fact that somebody made a module to solve the classical example game doesn’t mean that perl allows you to solve the task in an easier way.

    P.S. I’ll skim though that article, but I have already answered for myself that question – “difinetly Python!” :)


  2. The point wasn’t the solver for Sudoku. The point was that Perl has a very much central place with tested and documented (Ok, sometimes purely, but not that often) modules. There are modules to solve every task an average programmer comes across.

    Not only there are modules to solve specific problems, but there are modules which apply different algorithms to solving these problems. So the programmer can choose not only the module that solves his problem, but the module which solves his problem in the way he wants it to be solved.

    Development time is a very limited resources in so many projects, and Perl+CPAN help to minimize development time greatly. Central repository of modules and codes with standard ways of submitting them, reporting bugs, testing, and using them is something other programming languages should look into. CPAN – is code reuse at its best.


  3. yah!here i agree with your point. If u hav given the title then u must answer the query of thereader. as far as python is concerned I hav no such knowledge about it. I m just writing to agree with your point if u are writing the title u should give good response to the reader.

    Buy

Leave a Comment