python list handling and Lisp list handling

Paul Rubin http
Sat Apr 25 04:01:28 EDT 2009


Mark Tarver <dr.mtarver at ukonline.co.uk> writes:
> "Assuming the following Python encodings, and ignoring questions
> of performance, would Python and Lisp lists then be observationally
> indistinguishable? i.e. would these then be fair encodings?"
> is a 'yes'.   Any disagreement?

I don't think it is equivalent:

    Python 2.4.4 (#1, Oct 23 2006, 13:58:00) 
    [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a = [1,2,3] 
    >>> b = [4,5,6]
    >>> a[1:] = b   # the idea is to simulate (setf (cdr a) b)
    >>> print a
    [1, 4, 5, 6]
    >>> b[0] = 9    # (setf (car b) 9)
    >>> print a
    [1, 4, 5, 6]    # would expect [1,9,5,6]



More information about the Python-list mailing list