What's Great About Python
Lately, I've been doing some C and Scheme programming. Don't ask.
Using these languages reminds me of what's great about Python.
- No inconvenient simplifying assumptions. In Lisp/Scheme, it's
considered of utmost importance that the code itself is
represented in the same syntax as its data structures. This is
convenient for interpreter and compiler-writers, but it certainly
makes for some pretty ugly-looking application code. In C, you
are required to think of all of your data in terms of the storage
it occupies. This is also convienent for compiler writers, but
it's a harsh demand on application programmers. I like to think
of Python as a "no-excuses" kind of language. It doesn't make as
many simplifying assumptions on behalf of its implementors, but
makes lots of them on behalf of its users.
- No static type checking. I think Paul Graham said it
best with we need a language
that lets us scribble and smudge and smear, not a language where
you have to sit with a teacup of types balanced on your knee and
make polite conversation with a strict old aunt of a compiler.
Static type checking fans: get over yourselves. It's not helping
you.
- Almost everything is a first-class object. Need to pass a
function around? Go ahead. A method? No problem. A class?
That's fine. A module? Whatever. Python doesn't care.
Elaborate pointer manipulation can get you a lot of this in C, but
it's pretty painful.
- Scaling. Python allows you to start out writing simple code to do
simple things, ala "print 'hello'", which makes it great for
"scripting". But it is consistent enough to allow you to carry
all of the knowledge you gain this way into larger more
complicated tasks, such as creating and using classes and other
more OOish things. Lisp makes you learn about cars and cdr and
conses right away; you can't walk too far in C without bumping
into a pointer. Java makes you treat everything as a class.
Yikes. All I wanted to do was print hello. That said, when I do
want to define a hello class, Python will let me do it gracefully
and in a way that's not very unsimilar to the procedural scripting
way. I can reuse my knowledge of the language as I take it further.
- Built-in data structures. Who really doesn't need an
associative array type builtin? A dynamically-sized mixed-member
vector?
- Interactivity. Wow, is it nice to be able to enter in an
expression or even a short program into the Python command-line
prompt and see output right away without needing to compile. Of
course I like this about Lisp/Scheme too.
Created by
chrism
Last modified
2004-01-17 02:15 PM
I'm curious, which Scheme implementation(s) was you using?