[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT - trivial programming language



On Wed, May 26, 2004 at 07:21:38PM +0000, Faheem Mitha wrote:
| On Fri, 21 May 2004 20:33:14 -0400, richard lyons <richard@the-place.net> wrote:
| 
| > That makes two votes for Python (the other was off-list).  I've had it 
| > in mind to find time to investigate Python -- so I'll have a go at 
| > that.
| 
| Make that 3 votes. :-) I recently started learning Python. I like
| it. It has a very clean syntax.

Python is easy to learn, flexible, powerful, clean, and fun.  (IMO)
It scales down to "scripting" quite well and also scales up to
enterprise applications.  It is my preferred language.

If you are familiar with programming, then an hour or two spent
reading the tutorial (http://www.python.org/doc/tut/tut.html) will be
enough to learn most of the language.  If you aren't already familiar
with programming (in another language) then I recommend reading Alan
Gauld's tutorial instead
(http://www.freenetpages.co.uk/hp/alan.gauld/).

| Bob Proulx makes good points elsewhere in this thread. Whether you
| like the indentation as syntax feature is really a matter of
| taste. Personally, I am ambivalent about it. On the one hand it makes
| code more compact.

If you think indentation doesn't matter, join any C, C++ or Java
project and start suggesting new indentation conventions.  This is one
of the biggest never-ending sources of a flamewar you can find.  No
matter how you look at it, after you have written code (or even
prose!) for a while, you interpret the indentation level mentally as
you read the text.  Python takes it one step further and uses the same
interpretation you use to interpret the code.  You can easily write
wrong C or Java code that looks correct until you notice the
indentation and the punctuation (braces) don't match and the compiler
reads the code in a way you didn't intend.  My point is only that C
and Java programmers care about indentation just as much as Python,
even though some claim otherwise.

| On the other hand, indentation is easily lost
| information, for example when cutting and pasting.

In practice this isn't a problem.  Cut and paste the entire block of
code and the indentation is preserved.  Besides, you shouldn't try
using the "copy-n-paste" method of code reuse because it doesn't work
in the long run.

| Also, I have the
| habit in emacs of hitting tab to get code to line up. I've done this
| for years, and it is a hard habit to break.

Configure your editor correctly and this is not a problem.  I don't
use emacs, but you can find plenty of instructions on the web, I am
sure, to tell emacs how you want it to behave when the button on your
keyboard engraved with the label 'Tab' is pressed.

    http://www.python.org/emacs/python-mode/

If you use vim, set the following options.
    set et sts=4 sw=4 ts=8
With these settings, vim will use spaces only to indent, with an
indentation level of 4.  I can press the keyboard button labeled 'Tab'
3 times and vim inserts 12 spaces.  I can then press backspace once
and vim deletes 4 spaces (one indentation level) and I can begin
typing the line of code with 8 spaces of indentation.  Configure the
tool to serve you.

| Unfortunately it has
| disastrous consequences in python code.

Mixing tabs and spaces is bad, particularly if your configure your
editor to treat a tab (either in display or otherwise) as something
other than 8 spaces in width.  However, if you want to use tabs
exclusively that is not a problem.

| Bob says ruby is pretty good, and I believe him. However, libraries
| are a make-or-break feature. The nicest language in the world is
| useless without comprehensive libraries, and python is up there when
| it comes to libraries.

True.

-D

-- 
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org

Attachment: signature.asc
Description: Digital signature


Reply to: