Re: python list handling and Lisp list handling

2009-04-27 Thread Daniel Stutzbach
On Fri, Apr 24, 2009 at 10:19 AM, Mark Tarver wrote: > but also says that their representation is implementation dependent. > As far as I see this should mean that element access in Python should > run in constant time. Now if so this is a boon, because generally > When I first learned Python, I

Re: python list handling and Lisp list handling

2009-04-26 Thread J Kenneth King
Steven D'Aprano writes: > On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: > >> On Apr 26, 1:31 am, Steven D'Aprano > cybersource.com.au> wrote: >>> On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: >>> > That's because Python lists aren't lists. >>> >>> Surely you meant to say that Li

Re: python list handling and Lisp list handling

2009-04-26 Thread Steven D'Aprano
On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: > On Apr 26, 1:31 am, Steven D'Aprano cybersource.com.au> wrote: >> On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: >> > That's because Python lists aren't lists. >> >> Surely you meant to say that Lisp lists aren't lists? >> >> It-all

Re: python list handling and Lisp list handling

2009-04-25 Thread namekuseijin
On Apr 26, 1:31 am, Steven D'Aprano wrote: > On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: > > That's because Python lists aren't lists. > > Surely you meant to say that Lisp lists aren't lists? > > It-all-depends-on-how-you-define-lists-ly y'rs, Yeah, the List Processing language got it

Re: python list handling and Lisp list handling

2009-04-25 Thread namekuseijin
On Apr 25, 4:34 am, Michele Simionato wrote: > which has some feature you may like. For instance, > there is a weak form of pattern matching built-in: > > >>> head, *tail = [1,2,3] # Python 3.0 only! > >>> head > 1 > >>> tail > > [2, 3] Good seeing yet another long time Perl feature finally broug

Re: python list handling and Lisp list handling

2009-04-25 Thread Steven D'Aprano
On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: > That's because Python lists aren't lists. Surely you meant to say that Lisp lists aren't lists? It-all-depends-on-how-you-define-lists-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Wooding
Mark Tarver writes: > But are Python lists also indistinguishable from conventional > Lisplists for list processing. > > For example, can I modify a Python list non-destructively? No. > Are they equivalent to Lisp lists. Can CAR and CDR in Lisp be thought > of as > > def car (x): > return

Re: python list handling and Lisp list handling

2009-04-25 Thread Rhodri James
On Sat, 25 Apr 2009 08:07:19 +0100, Mark Tarver wrote: OK; I guess the answer to the question "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

Re: python list handling and Lisp list handling

2009-04-25 Thread Carl Banks
On Apr 25, 12:07 am, Mark Tarver wrote: > On 25 Apr, 05:01, Carl Banks wrote: > > > > > On Apr 24, 8:19 am, Mark Tarver wrote: > > > > This page says that Python lists are often flexible arrays > > > >http://www.brpreiss.com/books/opus7/html/page82.html > > > > but also says that their represent

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 10:01 am, Paul Rubin wrote: > Mark Tarver 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?"

Re: python list handling and Lisp list handling

2009-04-25 Thread Paul Rubin
Mark Tarver 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

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 9:07 am, Mark Tarver wrote: > OK; I guess the answer to the question > > "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'.

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
What is different is the concept of "all globals that > reference G".  For example: > > >>> a = [1, 2, 3] > >>> b = a > >>> a[0] = 0 > >>> print b > > [0, 2, 3] I see that Python had an id too ;). Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
On 25 Apr, 05:01, Carl Banks wrote: > On Apr 24, 8:19 am, Mark Tarver wrote: > > > > > > > This page says that Python lists are often flexible arrays > > >http://www.brpreiss.com/books/opus7/html/page82.html > > > but also says that their representation is implementation dependent. > > As far as

Re: python list handling and Lisp list handling

2009-04-24 Thread Carl Banks
On Apr 24, 8:19 am, Mark Tarver wrote: > This page says that Python lists are often flexible arrays > > http://www.brpreiss.com/books/opus7/html/page82.html > > but also says that their representation is implementation dependent. > As far as I see this should mean that element access in Python sho

Re: python list handling and Lisp list handling

2009-04-24 Thread Rhodri James
On Sat, 25 Apr 2009 00:32:26 +0100, Mark Tarver wrote: OK; I think I get it. RPLACA and RPLACD are part of the id of Common Lisp which I rarely contemplate. However what it seems to be is that the difference is this. Lisp operates a destructive operation like RPLACA in such a way that RPLAC

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 19:54, Arnaud Delobelle wrote: > Mark Tarver writes: > > Ah;  so this > > > def cons (x,y): > >   return [x] + y > > > is not accurate? > > Depends what you mean by accurate! > > in lisp, if you do: > >     (setq a '(1 2)) >     (setq b (cons 0 a)) >     (rplaca a 3) > > Then >     a i

Re: python list handling and Lisp list handling

2009-04-24 Thread Arnaud Delobelle
Mark Tarver writes: > Ah; so this > > def cons (x,y): > return [x] + y > > is not accurate? Depends what you mean by accurate! in lisp, if you do: (setq a '(1 2)) (setq b (cons 0 a)) (rplaca a 3) Then a is now (3 2) b is now (0 3 2) In Python, if you do: a = [1

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 17:19, Paul Rubin wrote: > Mark Tarver writes: > > But are Python lists also indistinguishable from conventional > > Lisplists for list processing.   > > Forgot to add: you might look athttp://norvig.com/python-lisp.html > > Mark Tarver writes: > > But ar

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver writes: > But are Python lists also indistinguishable from conventional > Lisplists for list processing. For example, can I modify a Python > list non-destructively? Are they equivalent to Lisp lists. Can CAR > and CDR in Lisp be thought of as Python lists are vectors that automatic

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver writes: > But are Python lists also indistinguishable from conventional > Lisplists for list processing. Forgot to add: you might look at http://norvig.com/python-lisp.html Mark Tarver writes: > But are Python lists also indistinguishable from conventional > Lisplists for list pr

Re: python list handling and Lisp list handling

2009-04-24 Thread MRAB
Mark Tarver wrote: This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. No

python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. Now if so this is a boo