Why is Python popular, while Lisp and Scheme aren't?

Pascal Costanza costanza at web.de
Sun Nov 24 16:45:06 EST 2002


Alexander Schmolck wrote:
> Kenny Tilton <ktilton at nyc.rr.com> writes:
> 
> 
>>don't know perl, but the other side of the coin I did not mention is that the
>>data is strongly typed.
> 
> 
> Hmm, I thought untyped means that variables don't have any type associated
> with them at all (like in assembler).
> 
> 

The most useful terminology I have seen so far is as follows.

* weakly typed vs. strongly typed: all languages define types to a 
certain degree, however some languages allow you to break the type 
system. Weakly typed languages do so, whereas strongly typed languages 
do not.

* statically typed vs. dynamically typed: some languages enforce their 
type system at compile time and some do so at run time. (compile time = 
statically typed, run time = dynamically typed)

So for example:
* C/C++ are statically and weakly typed
* Java, Haskell, CAML are statically and strongly typed
* Common Lisp, Smalltalk, Python, Ruby are dynamically and strongly typed

These classifications are not strict - there are always languages that 
are somewhere in between. (So for example, there are a small number of 
exceptions in Java where the language reverts to dynamic typing.)

> Well, it's not just "pragmatic advantages", I do believe that in some points
> python's *design* is just superior. Iteration and container classes seem
> fairly crufty to me in CL (not knowing CL that well, I might be wrong, in
> which case I'd much appreciate to be enlightend).
> 
[...]

> python:                           CL:                                              
> 
>                                    
>  x = list[index]                   (elt arrayOrList index)
>  x = hash[key]                     (gethash key  hash) ;; *why* this arg-order?
>  x = myType[indexOrKey]            ; no generalized item access
>                                                                                    
[etc.]

Unified access is always a bit problematic. You should not access a list 
  (in Common Lisp) by index because the list must always be traversed up 
to the index on each access. (As far as I understand, what Python calls 
lists are in fact arrays, and arrays don't have that problem.)

Now, in small or even medium sized programs this doesn't matter that 
much, but in bigger programs it does.

(And you don't want to generally replace lists by arrays, because arrays 
have their respective disadvantages as well.)


Pascal

-- 
Given any rule, however ‘fundamental’ or ‘necessary’ for science, there 
are always circumstances when it is advisable not only to ignore the 
rule, but to adopt its opposite. - Paul Feyerabend




More information about the Python-list mailing list