BASIC or Python?

Gerry Quinn gerryq at indigo.ie
Mon Jul 9 22:17:31 EDT 2001


In article <slrn9kkgfp.dj6.kamikaze at kuoi.asui.uidaho.edu>, kamikaze at kuoi.asui.uidaho.edu (Mark 'Kamikaze' Hughes) wrote:
>[ Followups set where they belong. ]
>
>Sun, 08 Jul 2001 14:52:13 GMT in <0t_17.14670$Fk7.131382 at news.indigo.ie>,
>Gerry Quinn <gerryq at indigo.ie> spake:
>> In article <slrn9kcfuq.2b7g.kamikaze at kuoi.asui.uidaho.edu>,
> kamikaze at kuoi.asui.uidaho.edu (Mark 'Kamikaze' Hughes) wrote:
>>>  Likewise, Python's string handling is IMO just brilliant; slicing is
>[...]
>>>string"""`.  What's not to love?
>> 
>> Remember that the meaning of a line depends on its indentation.  Plenty 
>> not to love, IMO.
>
>  That has nothing to do with strings, though.
>
>  However, do you not indent your code in C?
>if(foo)
>bar();
>  in a longer example would be unreadable and unmaintainable.  Python
>just eliminates the curly braces, and assumes you wrote exactly what you
>meant.  It also eliminates those idiotic religious arguments over
>indentation style, because there's only one correct indentation style.
>
>  It's a very old, very bogus argument, dragged out every time by the
>people who haven't used Python; once you program in Python, it becomes a
>non-issue.
>

In case anyone is fooled, here's an example from the tutorial at 
www.python.org, which also has a FAQ on what Python is for:

>>> for n in range(2, 10):
..     for x in range(2, n):
..         if n % x == 0:
..            print n, 'equals', x, '*', n/x
..            break
..     else:
..          print n, 'is a prime number'
.. 

Now some people may very well find that lovable, but I certainly don't.  
Note how the clever language design means that the 'else' must be 
level-indented with the 'for'.   No doubt longer programs are even more 
fun.  The FAQ on increasing speed helpfully notes that function calls 
are expensive...

The second print statement is one character offset from the 'if' - I 
don't know whether that is necessary or not.  It is unlikely that I will 
ever wish to know.

- Gerry Quinn









More information about the Python-list mailing list