20 Stages of Perl to Python Conversion

20 Stages of Perl to Python Conversion :: ASPN Mail Archive :: python- list:

20 Stages of Perl to Python Conversion

  1. See a reference to Python being compared favorably to Perl. Think to yourself, “another stupid little language that thinks it’s better than Perl.” Ignore it. Repeat many times.
  2. After seeing some reference to Python, decide, “what the hell, I’ll have a look.”
  3. Take a look at the language. Start with the tutorial. Become utterly aghast at the use of indentation for nesting. Think, “Where are the braces? Where are the begin and end statements?” Recall the horrors of Fortran 77. Spaghetti code. Fixed column format. Think about running away screaming.
  4. Decide instead to push on in disbelief. Encounter the part of the tutorial about modules. Become utterly aghast that Python does not place high importance on data hiding. Think, “Python not supporting data hiding goes against every fundamental principle of object oriented programming I know (especially since I’ve also been led to believe C++ is the beginning and end of OOP).”
  5. Run away screaming.
  6. Time passes.
  7. Realize that you’d overreacted. Think, “Python probably does have it’s place. It’s still no Perl.”
  8. See another reference to Python, this time even more favorable than before. Decide to give it another try, and maybe this time write some code instead of just follow the tutorial.
  9. Pick some little project, some little easy thing, you’ve been meaning to do. Get to work on it in Python.
  10. About halfway through the project, come to the sudden and ironic realization that the use indentation for nesting, which you had thought would you would never get used to, has become natural.
  11. Finish the project with only the typical minor difficulties involved in learning a new language, but without any major hair pulling.
  12. Acknowledge to yourself that Python is quite nice. Admit that there are some things about it better than Perl. Acknowledge that it is certainly better looking. Decide to use it again. Think, “It’s still no Perl.”
  13. Use Python again the next day for a slightly larger proejct. Only yesterday, you would have chosen Perl for this project without another thought. Even after finishing the previous day’s little project in Python, you had briefly considered using Python for this larger one, but decided to use Perl because it was too large to attempt with a language you were unfamiliar with. Today, however, you decide to use Python anyways. Python seems strangely alluring to you. Rationalize this by telling yourself that a larger project such as this is a good way to learn Python faster. Think, “It’s still no Perl.”
  14. Time passes. Life happens. Choose Python for several little projects that come along, all for the purpose of learning it better. Think, “Python is still no Perl.”
  15. Encounter a project much larger than anything you’ve used Python for yet. Decide, “OK, I’ve been using and liking Python for all these little projects I’ve been doing. Now that I have a much harder and larger project, it is time to use the proven workhorse, Perl, a language I am very familiar with and one that is ideally suited for this project.”
  16. Begin the project in Perl.
  17. After writing about ten lines, begin pulling out your hair. Become disgusted at the ugly travesty your fingers just produced. Recall the horrors of Perl. Poor indentation. Ambiguous semantics. Line noise. That section in the Perl man page where it gives several examples of “good ways” to implement a switch statement, while discouraging the most straightforward way. Think, “I cannot believe I’ve been swallowing this garbage for years. What a masochist I was. I was being screwed over by this pitiful hack of a language for all that time, and I loved it.”
  18. Run away screaming.
  19. Finish the project in Python.
  20. Refect upon your experience. Realize the dissidence of your former admiration of Perl. Remember the occasions where you would have questioned some of the now obvious design flaws in Perl, but didn’t, because Perl was everything cool, and everyone was using it. Think, “Python is still no Perl. Thank God.”
  21. (Optional) Log on to your favorite chat room, and never miss an opportunity to plug your new favorite language. Because your typical style is to use understatement, your firm and absolute devotion to Python will be perceived as a very strong message, that will make people think.

I wish our resident Perl zealots wouldn’t be just that: Zealots. A more open mind would help us all.

PS: Python is full of love and mind-numbing beauty.

💬 Reply by email     ⭐️ Also on micro.blog
Carlo Zottmann @czottmann