Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4380 > unrolled thread
| Started by | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| First post | 2011-05-01 08:45 +0000 |
| Last post | 2011-05-04 07:28 -0700 |
| Articles | 20 on this page of 176 — 34 participants |
Back to article view | Back to comp.lang.python
What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-01 08:45 +0000
Re: What other languages use the same data model as Python? Alec Taylor <alec.taylor6@gmail.com> - 2011-05-01 19:00 +1000
Re: What other languages use the same data model as Python? Chris Rebert <clp2@rebertia.com> - 2011-05-01 02:04 -0700
Re: What other languages use the same data model as Python? Terry Reedy <tjreedy@udel.edu> - 2011-05-01 15:10 -0400
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-02 10:37 +1200
Re: What other languages use the same data model as Python? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-05-02 07:45 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-02 13:12 +0000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-02 10:33 +1200
Re: What other languages use the same data model as Python? Terry Reedy <tjreedy@udel.edu> - 2011-05-01 21:42 -0400
Re: What other languages use the same data model as Python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-02 00:28 -0700
Re: What other languages use the same data model as Python? Duncan Booth <duncan.booth@invalid.invalid> - 2011-05-02 08:43 +0000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-03 13:39 +0100
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-03 14:49 +0000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-03 15:20 +0000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-03 22:10 +0100
Re: What other languages use the same data model as Python? Mel <mwilson@the-wire.com> - 2011-05-03 12:33 -0400
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-03 16:52 +0000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-03 21:47 +0100
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-04 08:00 +1000
Re: What other languages use the same data model as Python? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-05-04 02:56 -0700
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-04 10:51 +0000
Re: What other languages use the same data model as Python? Paul Rubin <no.email@nospam.invalid> - 2011-05-04 03:58 -0700
Re: What other languages use the same data model as Python? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-05-04 06:12 -0700
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 14:44 +0100
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-05 00:20 +1000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 18:09 +0100
Re: What other languages use the same data model as Python? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-05-04 09:18 -0700
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 18:03 +0100
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 20:55 +1200
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-05 11:31 +0100
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 21:21 +1200
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-07 19:28 +1000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-08 10:39 +1200
Re: What other languages use the same data model as Python? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2011-05-20 20:56 +0000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-08 02:17 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-07 23:10 -0500
Re: What other languages use the same data model as Python? rusi <rustompmody@gmail.com> - 2011-05-07 22:48 -0700
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-09 12:52 +1200
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-09 11:38 +0100
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-09 21:18 +1000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-09 21:53 +0100
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-09 14:29 +0000
Re: What other languages use the same data model as Python? Tim Golden <mail@timgolden.me.uk> - 2011-05-09 15:41 +0100
Re: What other languages use the same data model as Python? Ethan Furman <ethan@stoneleaf.us> - 2011-05-09 10:15 -0700
Re: What other languages use the same data model as Python? Mel <mwilson@the-wire.com> - 2011-05-09 13:38 -0400
Re: What other languages use the same data model as Python? Terry Reedy <tjreedy@udel.edu> - 2011-05-09 16:23 -0400
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-10 19:41 +1200
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-10 19:35 +1000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-11 10:47 +1200
Re: What other languages use the same data model as Python? Terry Reedy <tjreedy@udel.edu> - 2011-05-10 15:18 -0400
Re: What other languages use the same data model as Python? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2011-05-20 21:17 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-09 16:28 -0500
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-09 07:23 +0100
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 15:14 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 14:22 -0500
Re: What other languages use the same data model as Python? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-05-04 15:46 -0400
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 14:58 -0500
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 21:40 +0100
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 21:31 +1200
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 14:50 +0000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 12:14 +0000
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-05 22:37 +1000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 20:58 +0100
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 16:49 -0500
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-05 07:12 +0100
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 21:08 +1200
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-05 19:12 +1000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:30 +0000
Re: What other languages use the same data model as Python? TheSaint <nobody@nowhere.net.no> - 2011-05-07 20:18 +0800
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 12:49 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:31 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 09:40 -0500
Re: What other languages use the same data model as Python? Roy Smith <roy@panix.com> - 2011-05-05 10:49 -0400
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 14:47 -0500
Re: What other languages use the same data model as Python? Ben Finney <ben+python@benfinney.id.au> - 2011-05-05 07:43 +1000
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-05 12:43 +1000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 15:42 +0000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 22:04 +1200
Re: What other languages use the same data model as Python? Ben Finney <ben+python@benfinney.id.au> - 2011-05-08 06:09 +1000
Re: What other languages use the same data model as Python? Roy Smith <roy@panix.com> - 2011-05-07 16:24 -0400
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-08 10:54 +1200
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-08 09:43 +1000
Re: What other languages use the same data model as Python? Ben Finney <ben+python@benfinney.id.au> - 2011-05-08 11:16 +1000
Re: What other languages use the same data model as Python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-07 23:16 -0700
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-08 16:32 +1000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-10 13:49 +1200
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-10 03:13 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-10 14:05 +0000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-10 16:09 +0100
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-10 15:16 +0000
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-11 01:27 +1000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-10 16:40 +0100
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-11 01:44 +1000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-10 13:51 +1200
Re: What other languages use the same data model as Python? MRAB <python@mrabarnett.plus.com> - 2011-05-10 03:47 +0100
Re: What other languages use the same data model as Python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-09 23:15 -0700
Re: What other languages use the same data model as Python? John Nagle <nagle@animats.com> - 2011-05-04 14:52 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 19:46 -0500
Re: What other languages use the same data model as Python? John Nagle <nagle@animats.com> - 2011-05-04 21:32 -0700
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 22:06 +1200
Re: What other languages use the same data model as Python? John Nagle <nagle@animats.com> - 2011-05-05 08:41 -0700
Re: What other languages use the same data model as Python? Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-05 10:44 -0600
Re: What other languages use the same data model as Python? Chris Torek <nospam@torek.net> - 2011-05-06 17:57 +0000
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 21:39 +1200
Re: What other languages use the same data model as Python? Mel <mwilson@the-wire.com> - 2011-05-05 07:44 -0400
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-05 21:48 +1000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 13:59 +0000
Re: What other languages use the same data model as Python? John Nagle <nagle@animats.com> - 2011-05-05 08:58 -0700
Re: What other languages use the same data model as Python? Neil Cerutti <neilc@norwich.edu> - 2011-05-05 13:19 +0000
Re: What other languages use the same data model as Python? Terry Reedy <tjreedy@udel.edu> - 2011-05-05 14:39 -0400
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 11:56 +0100
Re: What other languages use the same data model as Python? Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-05-04 06:13 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 14:33 -0500
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-04 20:19 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 16:35 -0500
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-04 21:57 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 20:11 -0500
Re: What other languages use the same data model as Python? Mark Hammond <mhammond@skippinet.com.au> - 2011-05-05 12:09 +1000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 23:01 -0500
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 22:19 +1200
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:17 +0000
Re: What other languages use the same data model as Python? Roy Smith <roy@panix.com> - 2011-05-05 10:31 -0400
Re: What other languages use the same data model as Python? Neil Cerutti <neilc@norwich.edu> - 2011-05-05 15:10 +0000
Re: What other languages use the same data model as Python? Roy Smith <roy@panix.com> - 2011-05-05 11:29 -0400
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-06 08:01 +1000
Re: What other languages use the same data model as Python? Neil Cerutti <neilc@norwich.edu> - 2011-05-06 13:10 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 16:57 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 16:56 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 11:58 -0500
Re: What other languages use the same data model as Python? Neil Cerutti <neilc@norwich.edu> - 2011-05-05 17:39 +0000
Re: What other languages use the same data model as Python? Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-05 13:13 -0600
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 15:12 -0500
Re: What other languages use the same data model as Python? Tim Roberts <timr@probo.com> - 2011-05-04 20:23 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 23:55 -0500
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:21 +0000
Re: What other languages use the same data model as Python? Mel <mwilson@the-wire.com> - 2011-05-05 08:09 -0400
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-05 07:34 +0100
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 14:10 +0000
Re: What other languages use the same data model as Python? Mel <mwilson@the-wire.com> - 2011-05-05 11:30 -0400
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 10:56 -0500
RE: What other languages use the same data model as Python? Andreas Tawn <andreas.tawn@ubisoft.com> - 2011-05-05 18:27 +0200
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 22:09 +1200
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-06 07:56 +1000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:14 +0000
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 15:11 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 11:00 -0500
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 16:52 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 12:03 -0500
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-07 22:12 +1200
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-07 12:03 +0000
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 16:48 +0000
Re: What other languages use the same data model as Python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-05 22:24 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 11:18 -0500
Re: What other languages use the same data model as Python? Ethan Furman <ethan@stoneleaf.us> - 2011-05-05 10:28 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 12:19 -0500
Re: What other languages use the same data model as Python? Chris Torek <nospam@torek.net> - 2011-05-06 18:17 +0000
Re: What other languages use the same data model as Python? Chris Torek <nospam@torek.net> - 2011-05-06 19:06 +0000
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-06 14:25 -0500
Re: What other languages use the same data model as Python? Chris Angelico <rosuav@gmail.com> - 2011-05-07 09:43 +1000
Re: What other languages use the same data model as Python? Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-04 16:22 -0600
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-04 19:51 -0500
Re: What other languages use the same data model as Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-05 14:51 +0000
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-04 21:20 +0100
Re: What other languages use the same data model as Python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-04 22:10 -0700
Re: What other languages use the same data model as Python? harrismh777 <harrismh777@charter.net> - 2011-05-05 00:19 -0500
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:25 +0000
Re: What other languages use the same data model as Python? sturlamolden <sturla@molden.no> - 2011-05-04 07:44 -0700
Re: What other languages use the same data model as Python? Michael Torrie <torriem@gmail.com> - 2011-05-04 09:40 -0600
Re: What other languages use the same data model as Python? sturlamolden <sturla@molden.no> - 2011-05-04 09:40 -0700
Re: What other languages use the same data model as Python? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-05-04 13:15 -0400
Re: What other languages use the same data model as Python? sturlamolden <sturla@molden.no> - 2011-05-04 10:19 -0700
Re: What other languages use the same data model as Python? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-05 15:48 +1200
Re: What other languages use the same data model as Python? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-05 05:58 +0100
Re: What other languages use the same data model as Python? Grant Edwards <invalid@invalid.invalid> - 2011-05-05 14:24 +0000
Re: What other languages use the same data model as Python? Hrvoje Niksic <hniksic@xemacs.org> - 2011-05-03 15:50 +0200
Re: What other languages use the same data model as Python? sturlamolden <sturla@molden.no> - 2011-05-04 07:28 -0700
Page 2 of 9 — ← Prev page 1 [2] 3 4 5 6 7 8 9 Next page →
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2011-05-04 10:51 +0000 |
| Message-ID | <4dc12fb4$0$29991$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #4605 |
On Wed, 04 May 2011 02:56:28 -0700, Devin Jeanpierre wrote: > Python is pass-by-value in a > meaningful sense, it's just that by saying that we say that the values > being passed are references/pointers. This is maybe one level of > abstraction below what's ideal, "Maybe"? Given the following statement of Python code: >>> x = "spam" what is the value of the variable x? Is it...? (1) The string "spam". (2) Some invisible, inaccessible, unknown data structure deep in the implementation of the Python virtual machine, which the coder cannot access in any way using pure Python code. (Possibly a pointer, but since it's an implementation detail, other implementations may make different choices.) (3) Something else. I argue that any answer except for (1) is (almost always) counter- productive: it adds more confusion than shedding light. It requires thinking at the wrong level, at the implementation level instead of the level of Python code. If we define "value" to mean the invisible, inaccessible reference, then that leaves no word to describe was the string "spam" is. (I say "almost always" counter-productive because abstractions leak, and sometimes you do need to think about implementation.) > but Scheme, Java, etc. share this > terminology. (Ruby calls it pass-by-reference AFAIK. The intellectual contortions that some people will go through to hammer the square peg of actual programming language behaviour into the two round holes of "pass by value" and "pass by reference" never cease to astonish me. > Whatever, a rose by any other name...) Do you really think that roses would be the symbol of romantic love if they were called "disgusting stink-weeds of perversion and death"? "How was the date last night?" "Oh, it was marvelous! He presented me with a single red stink-weed, and then we went to a disgusting little restaurant. I had the swill." When people cannot agree on the definition of words, how can they communicate? Pass by reference Ruby is completely different from the older usage in Pascal, VB and other languages. Likewise, pass by value in Java is completely different from that in older languages. Pass by reference in Ruby, and pass by value in Java, describe the same thing. What were these people thinking? -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2011-05-04 03:58 -0700 |
| Message-ID | <7x62pqn34k.fsf@ruckus.brouhaha.com> |
| In reply to | #4606 |
Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes: >>>> x = "spam" > what is the value of the variable x? Is it...? > (1) The string "spam". Python works about the same way as Lisp or Scheme with regard to this sort of thing, and those languages have been described with quite a bit of mathematical formality. So if you want a precise theoretical treatment you might look at the Scheme report. It should be pretty clear how it carries over to Python.
[toc] | [prev] | [next] | [standalone]
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| Date | 2011-05-04 06:12 -0700 |
| Message-ID | <bcb5e532-9b2f-40a5-a586-e2a7768092ad@y12g2000yqh.googlegroups.com> |
| In reply to | #4606 |
On May 4, 6:51 am, Steven D'Aprano <steve +comp.lang.pyt...@pearwood.info> wrote: > On Wed, 04 May 2011 02:56:28 -0700, Devin Jeanpierre wrote: > > Python is pass-by-value in a > > meaningful sense, it's just that by saying that we say that the values > > being passed are references/pointers. This is maybe one level of > > abstraction below what's ideal, > > "Maybe"? > > Given the following statement of Python code: > > >>> x = "spam" > > what is the value of the variable x? Is it...? > > (1) The string "spam". > > (2) Some invisible, inaccessible, unknowndatastructure deep in the > implementation of the Python virtual machine, which the coder cannot > access in any way using pure Python code. > > (Possibly a pointer, but since it's an implementation detail, other > implementations may make different choices.) > > (3) Something else. As I said, a pointer or reference. > I argue that any answer except for (1) is (almost always) counter- > productive: it adds more confusion than shedding light. It requires > thinking at the wrong level, at the implementation level instead of the > level of Python code. If we define "value" to mean the invisible, > inaccessible reference, then that leaves no word to describe was the > string "spam" is. > > (I say "almost always" counter-productive because abstractions leak, and > sometimes you do need to think about implementation.) I don't know why you want to argue that it's counter-productive when all I said was that it was meaningful / worked. I don't think of "pass-by-value" involving references as being an implementation-level thing. It's a way of thinking about Python's behavior: a model. There don't even need to be actual references or anything resembling them inside the implementation in order to apply the model (for example, we probably all accept that Python could be implemented using a turing machine, which lacks references/pointers). Also, the word you suspected did not exist is "object". So if we have var = "spam", var is a variable containing a reference to the object "spam". Alternatively, it's a handle for the object "spam". I think that's the call-by-sharing terminology, anyway. > > but Scheme, Java, etc. share this > > terminology. (Ruby calls it pass-by-reference AFAIK. > > The intellectual contortions that some people will go through to hammer > the square peg of actual programming language behaviour into the two > round holes of "pass by value" and "pass by reference" never cease to > astonish me. It isn't particularly contorted. I learned Python this way and it makes perfect sense. It's just perhaps one level of abstraction away from the ideal of what some programmers would think in. Python's "pass- by-value" conforms exactly to the "pass-by-value" of other languages such as C. The only twist is that you never get to dereference pointers in Python, but you can in C. Not much of a twist if you ask me, but then again, I've been thinking in this model for years. Maybe I'm brainwashed. :) > > Whatever, a rose by any other name...) > > Do you really think that roses would be the symbol of romantic love if > they were called "disgusting stink-weeds of perversion and death"? > > "How was the date last night?" > "Oh, it was marvelous! He presented me with a single red stink-weed, and > then we went to a disgusting little restaurant. I had the swill." Please don't argue with me in this manner. The point is that words don't matter, the meaning behind them does. As long as it's clear what's meant, and what's meant is internally-consistent, I don't have much problem with it. Of course, this is a rule of thumb and you could draw extreme scenarios where it just becomes a bother. Devin Jeanpierre
[toc] | [prev] | [next] | [standalone]
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Date | 2011-05-04 14:44 +0100 |
| Message-ID | <7q1898-f3l.ln1@svn.schaathun.net> |
| In reply to | #4611 |
On Wed, 4 May 2011 06:12:14 -0700 (PDT), Devin Jeanpierre <jeanpierreda@gmail.com> wrote: : I don't think of "pass-by-value" involving references as being an : implementation-level thing. It's a way of thinking about Python's : behavior: a model. (...) : It isn't particularly contorted. I learned Python this way and it : makes perfect sense. It's just perhaps one level of abstraction away : from the ideal of what some programmers would think in. Python's "pass- : by-value" conforms exactly to the "pass-by-value" of other languages : such as C. It is contorted and implementation-level because it is one level below the abstraction assumed by the language. It only works by assuming knowledge of C, which is language which has proved unsuitable for complex and abstract data modelling. Digging down into C should be unnecessary to explain Python. By calling it pass-by-value you introduce a new data type which is unknown to Python, namely the pointer. : The only twist is that you never get to dereference : pointers in Python, but you can in C. Not much of a twist if you ask : me, but then again, I've been thinking in this model for years. Maybe : I'm brainwashed. :) You are. You explain Python in terms of C. That's useful when you talk to other speakers of C. If you want to explain the language to a broader audience, you should use terminology from the language's own level of abstraction. -- :-- Hans Georg
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-05 00:20 +1000 |
| Message-ID | <mailman.1147.1304518838.9059.python-list@python.org> |
| In reply to | #4613 |
On Wed, May 4, 2011 at 11:44 PM, Hans Georg Schaathun <hg@schaathun.net> wrote: > It is contorted and implementation-level because it is one level below > the abstraction assumed by the language. It only works by assuming > knowledge of C, which is language which has proved unsuitable for > complex and abstract data modelling. Digging down into C should be > unnecessary to explain Python. Sometimes, to explain Python, you need to dig down to the underlying hardware - even deeper than C, if you like. And that's always going to be the way, because abstractions leak from time to time. Or I should say, they occasionally have confidential briefings with the press. Abstracting everything perfectly is neither possible nor desirable. Chris Angelico
[toc] | [prev] | [next] | [standalone]
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Date | 2011-05-04 18:09 +0100 |
| Message-ID | <4sd898-0el.ln1@svn.schaathun.net> |
| In reply to | #4615 |
On Thu, 5 May 2011 00:20:34 +1000, Chris Angelico <rosuav@gmail.com> wrote: : Sometimes, to explain Python, you need to dig down to the underlying : hardware - even deeper than C, if you like. Sometimes you may need to narrow down the scope and explain a particular implementation of python with its hardware, OS, and interpreter. However, explaining just python, you do not know what the underlying hardware/OS/interpreter is, and digging down into it is not possible. : And that's always going to : be the way, because abstractions leak from time to time. Or I should : say, they occasionally have confidential briefings with the press. : Abstracting everything perfectly is neither possible nor desirable. Sure, but every language assumes a certain level of abstraction, and when the abstraction breaks the language fails to be unambiguous and/or portable. -- :-- Hans Georg
[toc] | [prev] | [next] | [standalone]
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| Date | 2011-05-04 09:18 -0700 |
| Message-ID | <b12913fb-cb13-475d-9ef7-5b6018a0f3ab@k15g2000pri.googlegroups.com> |
| In reply to | #4613 |
On May 4, 9:44 am, Hans Georg Schaathun <h...@schaathun.net> wrote: > : The only twist is that you never get to dereference > : pointers in Python, but you can in C. Not much of a twist if you ask > : me, but then again, I've been thinking in thismodelfor years. Maybe > : I'm brainwashed. :) > > You are. You explain Python in terms of C. That's useful when you > talk to other speakers of C. > > If you want to explain the language to a broader audience, you should > use terminology from the language's own level of abstraction. No, I explained Python in terms of pointers/reference. I don't speak C or come from a C background, I'm primarily a Python programmer. Also, I don't agree with your notions of "should", I have seen it taught this way to plenty of undergraduate students learning Python as their first programming language, and they do fine. The precise notational difference between sharing an object and copying a reference doesn't matter, as long as you can draw a diagram of it and write/read code -- which they can, and they do fine. I'm a bit uncomfortable with the vibe here. It's one thing for me to self-deprecatingly suggest I'm brainwashed (with a smile), and another for you to agree in complete seriousness. Devin Jeanpierre
[toc] | [prev] | [next] | [standalone]
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Date | 2011-05-04 18:03 +0100 |
| Message-ID | <9fd898-0el.ln1@svn.schaathun.net> |
| In reply to | #4623 |
On Wed, 4 May 2011 09:18:56 -0700 (PDT), Devin Jeanpierre <jeanpierreda@gmail.com> wrote: : I'm a bit uncomfortable with the vibe here. It's one thing for me to : self-deprecatingly suggest I'm brainwashed (with a smile), and another : for you to agree in complete seriousness. I am sorry. It was not meant to be an insult. I do think that you sit tightly in a frame of reference which is obviously not the only one appropriate, and IMNHO not the optimal one for the purpose. "Brainwashed" was not a word I meant to take seriously. Apologies. I should have cut the C reference too; the same frame of reference could be adopted from any number of languages. Note that it was not the use of references as a concept I objected to, but that they might be passed by value. With the references being purely abstract entities and not data objects, the idea that they have values do not make sense. And pass-by-value where the value is a reference is just confusing. -- :-- Hans Georg
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-05-05 20:55 +1200 |
| Message-ID | <92f70aF9pqU1@mid.individual.net> |
| In reply to | #4629 |
Hans Georg Schaathun wrote: > With the references being > purely abstract entities and not data objects, It's not clear to me that references are any more abstract than objects, or to put it another way, that objects are any less abstract than references. After all, in normal Python usage you never actually *see* an object -- at best you see some string of characters resulting from the str() or repr() of an object. The object is a mental construct we use to make sense of the behaviour we're seeing, as are references. If you were to look inside the interpreter closely enough to see the concrete representations of objects -- the bit patterns in memory making them up -- then you would also be able to see the bit patterns making up the references. -- Greg
[toc] | [prev] | [next] | [standalone]
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Date | 2011-05-05 11:31 +0100 |
| Message-ID | <dtaa98-crn.ln1@svn.schaathun.net> |
| In reply to | #4703 |
On Thu, 05 May 2011 20:55:36 +1200, Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote: : It's not clear to me that references are any more abstract : than objects, or to put it another way, that objects are : any less abstract than references. : : After all, in normal Python usage you never actually : *see* an object Sure, but you can refer directly to objects, pass objects around, and refer to individual objects. This is abstract in the sense that it is far removed from the memory representation. However, the concept of a reference appears only when you explain how objects are handled (semantics). You cannot reference nor manipulate a reference in python, and that IMHO makes them more abstract. -- :-- Hans Georg
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-05-07 21:21 +1200 |
| Message-ID | <92kh9cFgdcU1@mid.individual.net> |
| In reply to | #4710 |
Hans Georg Schaathun wrote:
> You cannot reference nor manipulate a
> reference in python, and that IMHO makes them more abstract.
You can manipulate them just fine by moving them
from one place to another:
a = b
You can use them to get at stuff they refer to:
a = b.c
a[:] = b[:]
You can compare them:
if a is b:
...
That's about all you can do with pointers in Pascal,
and I've never heard anyone argue that Pascal pointers
are any more or less abstract than any other piece of
data in that language.
As for "referencing" a reference, you can't really do
that in Pascal either, at least not the way you can
in C, because (plain) Pascal doesn't have an address-of
operator. The only way to get a pointer to a pointer
in Pascal is to heap-allocate a single pointer, which
isn't normally a very useful thing to do.
--
Greg
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-07 19:28 +1000 |
| Message-ID | <mailman.1286.1304760534.9059.python-list@python.org> |
| In reply to | #4894 |
On Sat, May 7, 2011 at 7:21 PM, Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote: > Hans Georg Schaathun wrote: > >> You cannot reference nor manipulate a reference in python, and that IMHO >> makes them more abstract. > > You can manipulate them just fine by moving them > from one place to another: I think "manipulate" here means things like pointer arithmetic, which are perfectly normal and common in C and assembly, but not in languages where they're references. Chris Angelico
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-05-08 10:39 +1200 |
| Message-ID | <92m01eFeilU1@mid.individual.net> |
| In reply to | #4895 |
Chris Angelico wrote: > I think "manipulate" here means things like pointer arithmetic, I don't believe that allowing arithmetic on pointers is a prerequisite to considering them first-class values. You can't do arithmetic on pointers in Pascal, for example, but nobody argues that Pascal pointers are not values. -- Greg
[toc] | [prev] | [next] | [standalone]
| From | Albert van der Horst <albert@spenarnc.xs4all.nl> |
|---|---|
| Date | 2011-05-20 20:56 +0000 |
| Message-ID | <llii6g.45q@spenarnc.xs4all.nl> |
| In reply to | #4895 |
In article <mailman.1286.1304760534.9059.python-list@python.org>,
Chris Angelico <rosuav@gmail.com> wrote:
>On Sat, May 7, 2011 at 7:21 PM, Gregory Ewing
><greg.ewing@canterbury.ac.nz> wrote:
>> Hans Georg Schaathun wrote:
>>
>>> You cannot reference nor manipulate a reference in python, and that IMHO
>>> makes them more abstract.
>>
>> You can manipulate them just fine by moving them
>> from one place to another:
>
>I think "manipulate" here means things like pointer arithmetic, which
>are perfectly normal and common in C and assembly, but not in
>languages where they're references.
Adding an integer to a reference to an array element could have been
perfectly well-defined in Algol:
ref real operator+(ref real, int)
That is called overloading of the plus operator not "pointer arithmetic".
It is a misconception that these manipulation are dirty or ill-defined
or unsafe.
A similar extension would be possible in Python.
Allusion to assembler where one adds a number to a register
and can't tell whether the register contains an address or data
are misleading.
[This is not to say that I think it is advisable].
>
>Chris Angelico
Groetjes Albert.
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2011-05-08 02:17 +0000 |
| Message-ID | <4dc5fd42$0$29991$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #4894 |
On Sat, 07 May 2011 21:21:45 +1200, Gregory Ewing wrote: > Hans Georg Schaathun wrote: > >> You cannot reference nor manipulate a reference in python, and that >> IMHO makes them more abstract. > > You can manipulate them just fine by moving them from one place to > another: > > a = b I see no reference there, nor do I see any moving taking place. What I see is a name binding operation. What is happening is that the name "a" is being bound to the object "b" (or to be precise, to whatever object is currently bound to name "b"). Since you haven't explained what you think is happening, I can only guess. My guess is that you are thinking about some implementation of the Python VM which uses some sort of reference internally. Perhaps it's CPython, which uses pointers, or some C++ implementation which actually uses an indirect pointer-like data structure called "reference", or maybe even some old-time FORTRAN I implementation that simulates pointers with integer indexes into a fixed size array. It could be anything. But whatever you're thinking of, it's not the behaviour of *Python* code, it's behaviour of the Python virtual machine's implementation. It astonishes me how hard it is to distinguish between abstraction levels when discussing computer languages. We don't have this problem in other fields. Nobody talking about (say) Solitaire on a computer would say: "Blat the pixels in the rect A,B,C,D to the rect E,F,G,H. That will free up the Ace of Spades and allow you to memcopy the records in the far right column of the tableau into the foundation." but when it comes to high-level computer languages like Python, we do the equivalent *all the time*. (I include myself in this.) And people get into (often angry) arguments over definitions, when what they're really arguing about is what is happening at different abstraction levels. A simplified view: At the Python level: binding of objects to names. No data is copied except by use of a direct "copy" instruction, e.g. slicing. At the Python VM level: objects pushed and popped from a stack. At the VM implementation level: Name binding may be implemented by copying pointers, or some other reference, in some data structure representing name spaces. Or by any other mechanism you like, so long as the behaviour at the Python level is the same. At the assembly language level: memory is copied from one address to another. At the hardware level: we usually describe bit manipulation in terms of binary AND, XOR and OR, but even that may be an abstraction: it's possible that the only binary op physically used by the machine is NAND. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | harrismh777 <harrismh777@charter.net> |
|---|---|
| Date | 2011-05-07 23:10 -0500 |
| Message-ID | <iJoxp.14507$Du7.1343@newsfe04.iad> |
| In reply to | #4932 |
Steven D'Aprano wrote:
> Nobody talking about (say) Solitaire on a computer would say:
>
> "Blat the pixels in the rect A,B,C,D to the rect E,F,G,H. That will free
> up the Ace of Spades and allow you to memcopy the records in the far
> right column of the tableau into the foundation."
>
> but when it comes to high-level computer languages like Python, we do the
> equivalent *all the time*.
I find exception to that argument. That is an example of the bogus
analogy fallacy. (I am offering this in friendship, actually). The two
cases have nothing to do with one another, do not affect one another
directly or indirectly, and are not helpful for comparison sake.
Analogies are generally not helpful in discussion and ought to be
avoided generally... except for entertainment sake... and frankly I have
found many of your analogies most entertaining (and creative) !
Second point, we seldom do anything *all the time* / this is a
fallacy that presupposes extreme references, as we think about the
argument; extreme exageration is not helpful... may or may not be
rightly extreme, and may or may not be relevant.
What can be said (about the argument) is that we sometimes waste
time arguing over abstraction layers with limited cross-dependent
understanding.
(I include myself in this.)
(myself, as well) ... the humility is appreciated.
> And people get
> into (often angry) arguments over definitions, when what they're really
> arguing about is what is happening at different abstraction levels.
Sometimes. More often than not, folks are not really angry (I am
seldom angry at my computer terminal... its one of the places where I
relax, learn, communicate, and relate with other computer scientists who
enjoy what they do because its enjoyable. I do agree with you that we
all sometimes talk past each other because we're arguing from within a
'different' level of abstraction.
kind regards,
m harris
[toc] | [prev] | [next] | [standalone]
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Date | 2011-05-07 22:48 -0700 |
| Message-ID | <1cf03d24-5e64-4770-a03b-b82978b35a6b@y27g2000prb.googlegroups.com> |
| In reply to | #4932 |
On May 8, 7:17 am, Steven D'Aprano <steve +comp.lang.pyt...@pearwood.info> wrote: > On Sat, 07 May 2011 21:21:45 +1200, Gregory Ewing wrote: > > Hans Georg Schaathun wrote: > > >> You cannot reference nor manipulate a reference in python, and that > >> IMHO makes them more abstract. > > > You can manipulate them just fine by moving them from one place to > > another: > > > a = b > > I see no reference there, nor do I see any moving taking place. What I > see is a name binding operation. What is happening is that the name "a" > is being bound to the object "b" (or to be precise, to whatever object is > currently bound to name "b"). > > Since you haven't explained what you think is happening, I can only > guess. My guess is that you are thinking about some implementation of the > Python VM which uses some sort of reference internally. Perhaps it's > CPython, which uses pointers, or some C++ implementation which actually > uses an indirect pointer-like data structure called "reference", or maybe > even some old-time FORTRAN I implementation that simulates pointers with > integer indexes into a fixed size array. It could be anything. > > But whatever you're thinking of, it's not the behaviour of *Python* code, > it's behaviour of the Python virtual machine's implementation. > > It astonishes me how hard it is to distinguish between abstraction levels > when discussing computer languages. We don't have this problem in other > fields. Nobody talking about (say) Solitaire on a computer would say: > > "Blat the pixels in the rect A,B,C,D to the rect E,F,G,H. That will free > up the Ace of Spades and allow you to memcopy the records in the far > right column of the tableau into the foundation." > > but when it comes to high-level computer languages like Python, we do the > equivalent *all the time*. It has to be so -- because the Turing machine like the modern computer is an unbelievable abstraction squasher. Yes unbelievable in the sense that people simply cant come to terms with this. [Witness your "It astonishes me..." Harris: "I take exception.." etc] The modern computer (von Neumann) <- self-modifying code <- Data=Code <- Undecidability (Halting problem) <- Consistency XOR Completeness (Godels theorem(s)) <- Leaky Abstractions as inevitable If anyone thinks Godels theorems are easy trivial, he probably does not know what he is talking about, Yet we think that computers are easy to understand? [Ive personally witnessed PhDs in computer science not appreciate compilers' inability to do certain things, and yet they could go and take a bunch of lectures on the halting problem. What they understand is anybody's guess :-) ] Coming back to topic: The argument (about bindings, variables etc) arises because python (like lisp) is an imperative language masquerading as a functional one. Such arguments dont arise in Haskell or in assembly language. They arise and are tolerable in C. They are terrible in C++ because all the abstractions are built to leak. Where python sits in this (circular) spectrum is an interesting question (and I watch the arguments with much interest)
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-05-09 12:52 +1200 |
| Message-ID | <92os6dF5jbU1@mid.individual.net> |
| In reply to | #4932 |
Steven D'Aprano wrote:
> Since you haven't explained what you think is happening, I can only
> guess.
Let me save you from guessing. I'm thinking of a piece of paper with
a little box on it and the name 'a' written beside it. There is an
arrow from that box to a bigger box.
+-------------+
+---+ | |
a | --+---------------->| |
+---+ | |
+-------------+
There is another little box labelled 'b'. After executing
'a = b', both little boxes have arrows pointing to the same
big box.
+-------------+
+---+ | |
a | --+---------------->| |
+---+ | |
+-------------+
^
+---+ |
b | --+-----------------------|
+---+
In this model, a "reference" is an arrow. Manipulating references
consists of rubbing out the arrows and redrawing them differently.
Also in this model, a "variable" is a little box. It's *not* the
same thing as a name; a name is a label for a variable, not the
variable itself.
It seems that you would prefer to eliminate the little boxes and
arrows and write the names directly beside the objects:
+-------------+
a | |
| |
b | |
+-------------+
+-------------+
c | |
| |
| |
+-------------+
But what would you do about lists? With little boxes and arrows, you
can draw a diagram like this:
+---+ +---+
a | --+----->| | +-------------+
+---+ +---+ | |
| --+----->| |
+---+ | |
| | +-------------+
+---+
(Here, the list is represented as a collection of variables.
That's why variables and names are not the same thing -- the
elements of the list don't have textual names.)
But without any little boxes or arrows, you can't represent the
list itself as a coherent object. You would have to go around
and label various objects with 'a[0]', 'a[1]', etc.
+-------------+
a[0] | |
| |
| |
+-------------+
+-------------+
a[1] | |
| |
| |
+-------------+
This is not very satisfactory. If the binding of 'a' changes,
you have to hunt for all your a[i] labels, rub them out and
rewrite them next to different objects. It's hardly conducive
to imparting a clear understanding of what is going on,
whereas the boxes-and-arrows model makes it instantly obvious.
There is a half-way position, where we use boxes to represent
list items, but for bare names we just draw the arrow coming
directly out of the name:
+---+
a --------->| | +-------------+
+---+ | |
| --+----->| |
+---+ | |
| | +-------------+
+---+
But this is really just a minor variation. It can be a useful
shorthand, but it has the drawback of making it seem as though
the binding of a bare name is somehow different from the
binding of a list element, when it isn't really.
Finally, there's another benefit of considering a reference to
be a distinct entity in the data model. If you think of the
little boxes as being of a fixed size, just big enough to
hold a reference, then it's obvious that you can only bind it
to *one* object at a time. Otherwise it might appear that you
could draw more than one arrow coming out of a name, or write
the same name next to more than one object.
It seems to me that the boxes-and-arrows model, or something
isomorphic to it, is the most abstract model you can make of
Python that captures everything necessary to reason about it
both easily and correctly.
--
Greg
[toc] | [prev] | [next] | [standalone]
| From | Hans Georg Schaathun <hg@schaathun.net> |
|---|---|
| Date | 2011-05-09 11:38 +0100 |
| Message-ID | <6qsk98-em1.ln1@svn.schaathun.net> |
| In reply to | #4967 |
On Mon, 09 May 2011 12:52:27 +1200, Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote: : Let me save you from guessing. I'm thinking of a piece of paper with : a little box on it and the name 'a' written beside it. There is an : arrow from that box to a bigger box. : : +-------------+ : +---+ | | : a | --+---------------->| | : +---+ | | : +-------------+ The flaw of this model, and I am not discounting its merits, just pointing out that it isn't perfect, is that it creates the illusion that references are boxes (objects) just like data objects, leading the reader to think that we could have a reference to a reference. If they are all boxes, by can't we make reference thereto? -- :-- Hans Georg
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-09 21:18 +1000 |
| Message-ID | <mailman.1330.1304939912.9059.python-list@python.org> |
| In reply to | #4988 |
On Mon, May 9, 2011 at 8:38 PM, Hans Georg Schaathun <hg@schaathun.net> wrote: > The flaw of this model, and I am not discounting its merits, just > pointing out that it isn't perfect, is that it creates the illusion > that references are boxes (objects) just like data objects, leading > the reader to think that we could have a reference to a reference. > If they are all boxes, by can't we make reference thereto? http://www.xkcd.com/895/ Analogies are like diagrams. Not all of them are perfect or useful. The boxes are different sizes. If you really want them to look different, do one as squares and one as circles, but don't try that in plain text. Chris Angelico
[toc] | [prev] | [next] | [standalone]
Page 2 of 9 — ← Prev page 1 [2] 3 4 5 6 7 8 9 Next page →
Back to top | Article view | comp.lang.python
csiph-web