Beautiful Python: The programming language that taught me how to love again


C++ was my primary programming language when my daughter was 3, and when I was growing bored and tired of convoluted, complex programming languages. Templates were new and exciting, or were they? I had used something similar in assembly languages years before this. Exception handling was a heated debate back then, when the forbidden GOTO was the only efficient way of localized error handling. There was no such thing as global error handling. Everyone was forced to write their own, passing codes or text or something to a hand written global error handler which performed errno.h lookups.

In short, lots of time was burned doing repetitive things in supposedly great languages. At least we all got paid to do it.

Then along came Perl. Perl rocked my world for many reasons. It was interpreted, so no long compilation cycles, hooray! It was very much like many of the FSF tools I had been using in UNIX for years. It was like the ultimate super sed/awk/grep tool, introducing new meta characters for things like whitespace. Hooray again! No more hours typing sed commands which check for one or more space, followed by one or more tabs, again followed by possibly more space characters, or some convoluted combination of space/tab/space…ARGH! Perl introduced this: ‘\w’, which caused me to have what seemed like an out of body experience, because I was so damned happy.

Then a person named Lincoln Stein wrote a perl module which made me quite a bit of contract money. It was called, and it was stunning. It allowed me to roll out CGI based web interfaces in week instead of months. I wrote many automation tools for AT&T, Lucent, Motorola, and many other companies, one after another, and loved every bit of it. I personally thanked Lincoln via e-mail, then started to pester him with questions, and did not hear back from him. But at least I was able to express my gratitude.

I was happy for a while. To me, Perl was no more convoluted than any other piece of UNIX scripting tool I have used before, so I adjusted well. But as new Perl modules started to appear, Perl started to be used for more complex tasks, which became a bit messy. Perl was still a procedural scripting language. Granted, any experienced developer can encapsulate with the best of them, and this is how procedural languages were kept under control. But it would be so nice to have a truly OO scripting language, many of us sighed.

Then along came Python. The best of all worlds, a byte-compiled scripting language, very OO, run time type checking, small, fast, robust, full support of OS and system calls, it had it all, in one neat package. It was love at first sight for me. I started using it for simple scripting tasks, such as directory walks, file searching, simple ten line scripts. I then started to learn TkInter, then WxPython, and before I knew it, I wrote a touch screen application in three months, entirely in one language. I no longer needed different tools, and wrappers, and interfaces from C to something else. It was all here, and the syntax seems almost intuitive. I once again started to find the fun in programming. Much like a long term relationship, we all need those reminders every now and then, so we can proclaim to ourselves “Ah, yes, NOW I remember why I fell in love with you in the first place”. Python was that catalyst for me. It really changed everything.

I now only program in Python. I have yet to find the need to use anything else. Even embedded systems support thin Python ports. Life is good, and I genuinely love the language and the tools I work with, warts and all.

39 Responses to “Beautiful Python: The programming language that taught me how to love again”

  1. Gloria W

    As far as code generation tools, I find that I don’t need them. IDEs exist for Python, but I found them overly complex. The language is simple, so I never needed an IDE. I tried using BoaConstructor for the wxPython work I did, and again found it much easier to code by hand (the inability to reverse integrate new code into the IDE is usually the deterrent for me).

    With respect to debugger tools, the built-in debugger called pdb works well for most cases. Pdb even works well enough in threaded web frameworks like CherryPy, so it has been an effective debugger.

    Hmm… the profiler, the doc generator, there are other tools, again, not ever needed on my end. Many of them seem like overkill. I do localized profiling via timestamps in my problem areas, and I always type up separate doc from my dev and code notes.

    What type of tools did you have in mind?

  2. Joseph Montanez

    I’m beating she uses emac or vim :P

    The path to python is truly an enlightening on. I coming from a strong web development use, I’ve always been stuck with using Php or Perl simply due to its in demand. I’ve picked up CherryPy, Django and Web.Py within the last year and I look back at Php with wonder why such a language walks so high. I actually picked up Python before Php, and every-time I have to write Php-code I just loose apart of me.

  3. Paddy3118

    I’m curious, have you been able to make Python pay as much as did? (It’s obvious that your happy with Python, which is worth a lot).

    - Paddy.

  4. Timmy Jose

    Oops…. sorry, make that “Excellent Mate” not “dude”!!! Very stupid of me to assume things. Nicely written article and refreshingly unbiased. I myself have become a Pythin aficionado and will be developing a major application in it soon!

  5. mind

    Python sucks. Really. I was in love with it. I still fall back on it occasionally. Everything seems to be pretty simple and well-defined and well thought out, but when you look under the hood, you wonder how the engine even runs. Various things are done several different ways depending on the context you call things in, etc. (I’m talking about CPython here). My last big frustration was its (lack of) thread support, aka the ‘global interpreter lock’.. sure you can make threads, but only one can be running at any given time. I’ve looked at jython, with which you can even compile python into java, but unfortunately they’re moving away from compilation back to interpreting (I had hoped to write real java classes, but if that’s being deprecated, I’m not going to base a new project on it). I haven’t found a suitable replacement yet, I guess I’m just ranting because I did like the language, and now it just seems clunky.

  6. Catherine Devlin

    I’m crazy for Python, too. I’m not even a real programmer – I’m a chemical engineer who’s faking it as a database administrator who’s faking it as a programmer – but Python helps me learn and use good programming technique, while being wondefully productive. And Python’s the only language in which I can comfortably read, debug, and contribute code in the open-source community – it’s just that clear.

    mind, you might be interested in IronPython – I understand it avoids the GIL problem entirely. And yes, it’s open-source, and you can run it on Mono. Otherwise, projects like Stackless and PyPy may interest you – big question mark there, since threading/GIL is an issue I’ve never had to deal with.

  7. Will

    I’m another Python supporter, and I’m lucky enough to be working on it full time.

    In response to ‘mind’, the GIL does not prevent threads from running simultaneously because libraries release the GIL for time consuming tasks. Processes are the ultimate tool for scalability, which are easy to use in Python.

  8. Scott

    I was fascinated by Python when Bittorent hit the scene, so picked up Programming Python.. And got amazingly frustrated.

    Every single approach to learning the language that I’ve seen starts with the CLI. As much as I appreciate being able to test out structures in that kind of environment, learning the language there is amazingly frustrating for someone used to pooping out files for testing. What’s the benefit? I can look back on what I did to refresh myself. It wasn’t until near the end of the book that they introduced py’s.

    It soured me on Python, and only recently have I started to look into it again.

  9. Poromenos

    mind, that’s not a problem with Python, that’s a problem with the Python interpreter (CPython). The language itself and the interpreter are rather different things…

  10. popjack

    I’m with you, Catherine Devlin. I’m totally faking it as a programmer in my job as Tech VP for a small publisher. I use Python scripts for all of the data analysis and reporting against marketing campaigns, I use the Python wrappers for Google and Amazon APIs and more. The fact that we can do all that we do right beside real programmers like the author who use Python for major projects tells you all you need to know about the elegance and clarity of a great language.

    Nice article. Thanks!

  11. t0p

    Try LISP. I think you’ll like it as well.

    Try not to use EMACS if at all possible. That’s just horrible. I use vim to edit my files.

    MmmMMmmm VimmMMMmmm.


  12. JoJo

    Nice article. Iam learning Python now and I know nothing about programming. How long do you think
    it takes to get to a payable position?

  13. Ferio

    Hi, I’ve just got here through, and I’ve something to say: I’ve been working for some time doing XHTML, and CSS, and JavaScript, and PHP, and Java, and C++, and C#, and VB.NET… Yesterday I got a different and nicer job in which I won’t be programming at all and that will last for my entire life if that’s what I want (a State worker job).

    I’ve been willing to study Python for a long time, so I bought me O’Reilly’s Learning Python yesterday and, just in 1 day, I’ve to say it’s the nicest programming language I’ve ever learnt: it makes me fall in love with programming again, just as you’ve said. I can’t wait to master it and contribute to some Free Software project if I can.

  14. Andrew

    I have long been an advocate for Python. I use it for anything that requires a desktop application, I’m still pretty partial to PHP for web programming. I suppose the next step is to work on getting my Comet going for some of that push-Ajax goodness.

    Did anyone mention that it’s completely cross-platform? I’ve managed to convince my employer this is the way to go with a new application we’ve been working on. OSX, Linux, Windows, Sparc64, doesn’t matter! It works!

  15. rev_matt_y

    I got into python by way of Zope about 8 years ago (damn, has it really been that long?). I only do it on the side as my main job is Configuration Manager on a J2EE project, but I much prefer Python for pretty much anything I do. I even use it over AppleScript for coding little housecleaning utilities on my computers.

    I’ve used all the various Python IDE’s and they’re not so much IDE mostly as text editors with some extras stapled on. Wing, Boa, ActiveState are the ones I can think of off the top of my head. I never liked any of them enough to use them over vi. TextMate is a pretty awesome text editor if you’re on a Mac, however.

  16. gloriajw

    VI is my favorite too. No surprise there, I am sure. VIM rocks. With a robust command line, a good editor, and a great language, what more do you need?

  17. karson

    Nice article, I came to Python from C++ & Java as well. Emacs is my editor of choice for Python.

    Scott, programming is not like you see in the movies — no dragging and dropping 3D boxes. Using the CLI is standard for most programming work, and if you’re scared of white text on a black background you should look for a new line of work. Or become a MSCE.

    t0p, you’re a Lisp evangelist pimping VIM. That’s some serious cognitive dissonance. You should know that Emacs uses Lisp for most of its functionality.

  18. kinghajj

    Ruby is nice, but I hate it’s syntax. ‘end’ statements are not needed at all, and Python proves that. Python is smart in that regard.

    Also, Python is fun to hack. I’ve spent much time just playing in the CLI interpreter, learning how things work and fit together.

  19. gg

    Perl has has a perfectly good – and very *flexible* object system for quite a while.

    In fact, with Perl, you didn’t have to wait for Guido to change the language implementation to twist the object system the way you wanted.

    Bu I guess you are just one of those who never couldn’t really grok Perl’s full power. And there you are.

  20. no

    My thoughts on Python? A little better than perl, but with far less documentation, resources and code libraries.

    I’d love to use it, but as a self taught everything with no friends or coworkers who use python, I have to stick with langauges that have enormous online support.

  21. karson

    My thoughts on Perl v. Python:

    I learned Perl before Python, and I really enjoyed it.. at first. While there are some problems, structurally, with Perl the biggest drawback is that it is very difficult to maintain code written in it. Specifically, Perl’s strength “There is more than one way to do it” (TIMTOWTDI) is also its biggest weakness. Have you ever tried to maintain a legacy Perl app? I have, and it’s a nightmare — you have to decipher the ambiguous syntax of a programmer that is long gone.

    Python is designed for maintainability. The forced indentation, that Perl and Ruby hackers hate, is an asset. It standardizes the look of the code and makes it more readable and thus maintainable. Further, documentation within the code is encouraged with docstrings. At the CLI type “help()” and its documentation will appear, very cool.

    Now to the structural problems of Perl:
    (1) Despite what gg says, OO in Perl is a _hack_. Perl never had OO programming in mind and it shows in its kludgy implementation. Python, on the other hand, was designed from the ground up with OO in mind. As far as flexibility, I fail to see how Python is inflexible — you can dynamically create classes (with metaclasses) and manipulate any attribute of an object with the (has|get|set)attr methods. Inflexible — hardly.

    (2) Perl has not aged well. The strange internals of the interpreter have made maintenance and feature adding difficult. Perl 6 you say? I want Parrot to come — but it’s been _years_ — PyPy probably has already superseded Parrot in the development process.

    Perl is still king when it comes to string parsing. Also, when you need a quick & dirty script to get stuff done it’s an excellent choice. But, Python is my preference with regards to maintainable, lasting software. My recommendation for Perl heads — move to Ruby (the folks at Metasploit did, and it’s worked wonders for them).

  22. gloriajw

    Yes, OO in perl was terrible, not even really usable. W.R.T using Perl for small tasks, I am a purist. Once I made the switch, I stuck with it. It forced me to learn Python ‘re’ much better, so I’m glad I did.

  23. Tzury Bar Yochay

    Same here with the falling in love but different.
    For long time I was looking for the lang that will help me switch from the MS world to the Unix world. I couldn’t stand the fact that Java will be my .NET replacement and therefore I postponed the switching until I found this 3.14Ton (this is how our team call the language in the corridors when we don’t want the bosses to know that we are actually writing in a different language than .NET).
    I use for web applications and can tell clearly that it is much better than any web platform I’ve ever seen (inc. PHP, .NET, ASP)

  24. killer

    i use PSPAD as my python IDE. very neat because there is a function browser on the side. :)

  25. w00tz

    Python – the king language. The motherload. The one that shames the rest. After years of ASM, C++, and Java, Perl, and PHP, I have finally settled on the language that I can finally call my favorite.

    That is Python. Python is king. Long live Python. Long live Guido.

  26. zgoda

    My path was opposite of yours: I started with REXX and Smalltalk, at some time I learned Python, got a Python job, then suddenly I had to write much code in Java. It was horrible experience. Having spent over 5 years with very dynamic languages, I felt like my hands were coined. Very natural things (for Python, of course) was nearly impossible (think of populating the list with function objects to be able to iterate over the list and call all these functions…). How frustrating.
    Thanks God, finally I was able to get back to coding in Python (using Django web framework, which is not that bad at all…).

  27. André Castelo

    All this loving for python makes me more comfortable learning it. Just started, bought the Learning Python book and so far, python is wonderful.

  28. Jeffy the Beast

    I love Python too. To answer a question from above: unfortunately nothing will ever make us as much money as Those days are over :(


Leave a Reply