merits of Lisp vs Python

greg greg at cosc.canterbury.ac.nz
Tue Dec 12 22:07:01 EST 2006


Robert Uhl wrote:

> o Symbols
> 
> In Lisp, a symbol is essentially a hashed string;

Are you aware that strings can be interned in Python?
Furthermore, any string literal in the source that
is a syntactically valid identifier is automatically
interned, and you can intern any string explicitly
if you need. This gives you exactly the same
capabilities as symbols in Lisp.

For example, due to the automatic interning, the
string comparison in the following is just a pointer
comparison:

    fred = 'hello'
    if fred == 'hello':
       print 'Greetings'

--
Greg



More information about the Python-list mailing list