Python and Ruby

Lou Pecora pecora at
Wed Feb 3 23:54:57 CET 2010

In article 
<1944d953-25ad-440b-9317-a7a4b4de6dac at>,
 Jonathan Gardner <jgardner at> wrote:

> I can explain all of Python in an hour; I doubt anyone will understand
> all of Python in an hour.
> Coming from perl to python, the big "aha!" moment was when I realized
> there wasn't anything more than what I saw before me. I kept expecting
> something big around the corner, kind of like when I first discovered
> refs in perl, or when I realized how hard it truly was to write OO
> code in perl that actually does what you think it should do.
> Perl has trained me to be fearful of the language, constantly on the
> lookout for jabberwockies. If you fall into one of those traps in
> perl, it's because you weren't smart enough and aren't worthy of the
> language, or so they say. It's never perl's fault. I mean, doesn't
> everyone know what the Schwartzian Transform is?
> Python is the complete opposite. Go through
> . Once you've familiarized yourself with all the operators,
> statements, and the special methods, you're done with syntax and the
> core language. There is no more.
> The next step is to learn the basic objects and functions in builtins.
> That's in the first seven chapters of 
> You can always fall back to the "help" function to remind yourself if
> you forget. I do it all the time.
> After that, it's merely figuring out which standard libraries do what
> and how. The documentation there is complete and awesome, and there
> are more than enough people willing to point you in the right
> direction here.
> There are no dragons in this forest. Heck, this isn't even a forest---
> it's a single-room apartment with everything you need right there
> where you can see it. The thermostat is set to room temperature, and
> no matter what happens outside, you're safe and protected from it all.

That's a pretty accurate description of how I transitioned to Python 
from C and Fortran.  I kept trying to think of how to output data and 
parameter variables of different types to files for later reading in.  
How to format them all consistently and then get them back in with the 
exact same accuracy.  I was stuck in printf and scanf land.  Then after 
much noodling around and reading it hit me that I could just put all 
that output of different types of variables into a list, hit it with a 
repr() function to get a string version, and write the string to a file 
-- no formatting necessary-- three lines of code. Later reading in the 
string version (no formatting necessary), and hitting it with an eval() 
function returned all the values I originally had in those variables.  
How simple, but beautiful.  I was making it harder when Python was 
making it easier.  Trained on the wrong language.

-- Lou Pecora

More information about the Python-list mailing list