BASIC or Python?

phil hunt philh at comuno.freeserve.co.uk
Tue Jul 10 13:31:24 CEST 2001


On Tue, 10 Jul 2001 02:17:31 GMT, Gerry Quinn <gerryq at indigo.ie> wrote:
>
>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.

I don't wish you to know either. Python is far too sensible a
language for the likes of you to be using it.

-- 
## Philip Hunt ## philh at comuno.freeserve.co.uk ##







More information about the Python-list mailing list