Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98999 > unrolled thread
| Started by | fl <rxjwg98@gmail.com> |
|---|---|
| First post | 2015-11-18 13:08 -0800 |
| Last post | 2015-11-25 03:11 +1100 |
| Articles | 20 on this page of 198 — 24 participants |
Back to article view | Back to comp.lang.python
What is a function parameter =[] for? fl <rxjwg98@gmail.com> - 2015-11-18 13:08 -0800
Re: What is a function parameter =[] for? John Gordon <gordon@panix.com> - 2015-11-18 22:05 +0000
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-18 15:11 -0700
Re: What is a function parameter =[] for? Grant Edwards <invalid@invalid.invalid> - 2015-11-18 22:33 +0000
Re: What is a function parameter =[] for? fl <rxjwg98@gmail.com> - 2015-11-18 14:38 -0800
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-18 15:47 -0700
Re: What is a function parameter =[] for? fl <rxjwg98@gmail.com> - 2015-11-18 14:48 -0800
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-18 23:14 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-19 10:22 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 01:41 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-19 12:59 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 11:41 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-19 22:58 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-19 23:45 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-19 08:42 -0700
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-22 14:58 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 13:38 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 04:29 +1100
Re: What is a function parameter =[] for? Ben Finney <ben+python@benfinney.id.au> - 2015-11-19 13:08 +1100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-19 13:15 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-18 17:02 -0700
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-19 11:14 +1100
Re: What is a function parameter =[] for? fl <rxjwg98@gmail.com> - 2015-11-18 16:34 -0800
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-18 17:52 -0700
Re: What is a function parameter =[] for? MRAB <python@mrabarnett.plus.com> - 2015-11-19 01:02 +0000
Re: What is a function parameter =[] for? Ben Finney <ben+python@benfinney.id.au> - 2015-11-19 12:26 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-19 22:38 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-19 23:19 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 13:19 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 00:45 +1100
Re: What is a function parameter =[] for? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-19 09:05 -0500
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-20 03:01 +1100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 04:30 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 17:30 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 04:45 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 18:19 +0000
Re: What is a function parameter =[] for? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-19 18:26 +0000
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 18:50 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 06:09 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 19:48 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 06:58 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-20 11:26 +1100
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-19 16:36 -0800
Re: What is a function parameter =[] for? Laura Creighton <lac@openend.se> - 2015-11-20 02:00 +0100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-19 17:59 -0700
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-19 20:39 +0200
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-19 11:42 -0700
Re: What is a function parameter =[] for? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-11-19 18:44 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-20 06:19 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-19 21:21 +0000
Re: What is a function parameter =[] for? Michael Torrie <torriem@gmail.com> - 2015-11-19 15:55 -0700
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-20 00:11 +0000
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-19 16:27 -0800
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 14:43 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 01:00 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 15:24 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 01:34 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 16:01 +0100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 16:03 +0100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 16:12 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 02:17 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 04:54 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 16:46 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 02:48 +1100
Re: What is a function parameter =[] for? Random832 <random832@fastmail.com> - 2015-11-24 16:28 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 03:38 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 17:41 +0100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 09:56 -0700
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 18:32 +0100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 10:53 -0700
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 11:04 -0700
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 19:45 +0100
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 10:54 -0800
Re: What is a function parameter =[] for? Random832 <random832@fastmail.com> - 2015-11-24 19:00 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 11:34 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 12:15 -0700
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 12:15 -0700
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 21:54 +0100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-24 21:14 +0000
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 22:25 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 11:36 +1100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 11:56 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 10:56 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-26 04:40 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 19:27 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-26 11:10 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-25 13:39 -0700
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 22:05 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-26 09:06 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-25 15:38 -0700
Re: What is a function parameter =[] for? Alan Bawden <alan@csail.mit.edu> - 2015-11-25 21:08 -0500
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-26 13:25 +1100
Re: What is a function parameter =[] for? Alan Bawden <alan@csail.mit.edu> - 2015-11-25 23:27 -0500
Re: What is a function parameter =[] for? Dave Farrance <df@see.replyto.invalid> - 2015-11-26 10:34 +0000
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-26 12:58 +0200
Re: What is a function parameter =[] for? Dave Farrance <df@see.replyto.invalid> - 2015-11-26 11:12 +0000
Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?) Ben Finney <ben+python@benfinney.id.au> - 2015-11-26 22:24 +1100
Re: Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?) Dave Farrance <df@see.replyto.invalid> - 2015-11-26 11:50 +0000
Re: Object identity has no necessary connection to memory location Ben Finney <ben+python@benfinney.id.au> - 2015-11-27 07:00 +1100
Re: Object identity has no necessary connection to memory location Steven D'Aprano <steve@pearwood.info> - 2015-11-27 13:17 +1100
Re: Object identity has no necessary connection to memory location Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-26 21:44 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-26 22:24 +1100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-26 13:27 +0200
Re: Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?) Chris Angelico <rosuav@gmail.com> - 2015-11-26 22:49 +1100
Re: Object identity has no necessary connection to memory location Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 13:04 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-27 12:34 +1100
Re: What is a function parameter =[] for? Ben Finney <ben+python@benfinney.id.au> - 2015-11-27 12:40 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-27 13:44 +1100
Re: What is a function parameter =[] for? MRAB <python@mrabarnett.plus.com> - 2015-11-27 02:56 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-27 23:57 +1100
Re: What is a function parameter =[] for? Laura Creighton <lac@openend.se> - 2015-11-27 14:24 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-28 00:29 +1100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-27 14:06 +1100
Re: What is a function parameter =[] for? Ben Finney <ben+python@benfinney.id.au> - 2015-11-27 15:56 +1100
Re: What is a function parameter =[] for? Random832 <random832@fastmail.com> - 2015-11-26 23:33 -0500
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-25 19:46 -0700
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-26 14:02 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 09:15 +0100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-24 14:33 -0700
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 09:09 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-19 12:25 -0700
Re: What is a function parameter =[] for? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-19 18:20 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-20 12:05 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-20 11:59 +0000
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-20 04:12 -0800
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-20 12:39 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-21 00:04 +1100
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-20 05:30 -0800
Re: What is a function parameter =[] for? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-20 08:34 -0500
Re: What is a function parameter =[] for? Random832 <random832@fastmail.com> - 2015-11-20 14:32 +0000
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-20 09:18 -0700
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-22 23:01 +1100
Re: What is a function parameter =[] for? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-23 12:30 +1300
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 15:38 +0100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 15:34 +0100
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 06:50 -0800
Re: What is a function parameter =[] for? Terry Reedy <tjreedy@udel.edu> - 2015-11-24 12:46 -0500
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 19:27 +0100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-20 14:28 +0200
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-20 12:53 +0000
Re: What is a function parameter =[] for? Random832 <random832@fastmail.com> - 2015-11-20 14:35 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-22 21:06 +1100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-22 14:35 +0200
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-20 09:16 -0700
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-20 18:31 +0200
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-21 03:37 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-20 09:39 -0700
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-21 03:24 +1100
Re: What is a function parameter =[] for? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-20 09:29 -0700
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-20 18:41 +0200
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-21 03:36 +1100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-22 14:43 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-22 13:21 +0000
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-22 14:28 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-23 10:44 +1100
Re: What is a function parameter =[] for? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-23 00:04 +0000
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-23 00:37 +0000
Re: What is a function parameter =[] for? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-23 11:32 +0000
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-23 04:05 -0800
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-23 14:23 +0200
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-23 11:20 +1100
Re: What is a function parameter =[] for? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-23 12:43 +1300
Re: What is a function parameter =[] for? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-11-23 18:47 +1100
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-23 10:40 +0000
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-24 00:58 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 15:58 +0100
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 04:56 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 15:18 +0100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 14:48 +0100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 12:36 +0100
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-24 23:07 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 13:48 +0100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-24 14:57 +0200
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 06:18 -0800
Re: What is a function parameter =[] for? BartC <bc@freeuk.com> - 2015-11-24 14:43 +0000
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-25 01:54 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-24 16:10 +0100
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 07:27 -0800
Re: What is a function parameter =[] for? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-11-24 17:25 +0000
Re: What is a function parameter =[] for? Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 09:35 -0800
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-24 20:13 +0200
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 05:33 +1100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-24 21:17 +0200
Re: What is a function parameter =[] for? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-24 11:27 -0500
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 11:39 +1100
Re: What is a function parameter =[] for? Laura Creighton <lac@openend.se> - 2015-11-25 01:55 +0100
A name refers to an object, an object has a value, equality compares values (was: What is a function parameter =[] for?) Ben Finney <ben+python@benfinney.id.au> - 2015-11-25 13:17 +1100
Re: A name refers to an object, an object has a value, equality compares values Marko Rauhamaa <marko@pacujo.net> - 2015-11-25 08:44 +0200
Re: A name refers to an object, an object has a value, equality compares values Chris Angelico <rosuav@gmail.com> - 2015-11-25 19:27 +1100
Re: What is a function parameter =[] for? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 10:36 +0100
Re: What is a function parameter =[] for? Jussi Piitulainen <harvest@should.be.invalid> - 2015-11-25 13:39 +0200
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-25 14:48 +0200
Re: What is a function parameter =[] for? Chris Angelico <rosuav@gmail.com> - 2015-11-26 00:50 +1100
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-25 16:08 +0200
Re: What is a function parameter =[] for? Jussi Piitulainen <harvest@should.be.invalid> - 2015-11-25 17:13 +0200
Re: What is a function parameter =[] for? Marko Rauhamaa <marko@pacujo.net> - 2015-11-25 18:44 +0200
Re: What is a function parameter =[] for? Jussi Piitulainen <harvest@should.be.invalid> - 2015-11-25 20:30 +0200
Re: What is a function parameter =[] for? Steven D'Aprano <steve@pearwood.info> - 2015-11-25 03:11 +1100
Page 5 of 10 — ← Prev page 1 … 3 4 [5] 6 7 … 10 Next page →
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-25 11:36 +1100 |
| Message-ID | <56550273$0$1585$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99397 |
On Wed, 25 Nov 2015 08:25 am, Antoon Pardon wrote: > The point is that a > tuple can just be loaded as a constant without needing something extra. How would one load this tuple as a constant? (myfile.read(), "%.5f" % sin(x or y)) The point is that *in general*, tuple so-called "literals" (what the docs call displays) cannot be loaded as constants. If, and only if, the tuple contains nothing but immutable constants e.g. (1, 2.0, None, "spam") then a sufficiently smart compiler may be able to treat that specific tuple as a constant/literal. But that's a special case, and cannot be generalised to all tuple displays. All tuple so-called "literals" e.g. (), (1, 2), (x, y, z) etc. are fundamentally expressions that *may* have to be built at runtime. Hence the word "literal" is inappropriate. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-25 11:56 +1100 |
| Message-ID | <mailman.43.1448413008.20593.python-list@python.org> |
| In reply to | #99405 |
On Wed, Nov 25, 2015 at 11:36 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> If, and only if, the tuple
> contains nothing but immutable constants e.g.
>
> (1, 2.0, None, "spam")
>
> then a sufficiently smart compiler may be able to treat that specific tuple
> as a constant/literal. But that's a special case, and cannot be generalised
> to all tuple displays.
In which case it's simply an example of constant-folding. It's the
same as (1+2j) being called up with LOAD_CONST, despite being an
expression. Recent CPythons are even willing to change what data type
something is, to make it a constant:
>>> dis.dis(lambda x: x in ["a","b","c","d","e"])
1 0 LOAD_FAST 0 (x)
3 LOAD_CONST 6 (('a', 'b', 'c', 'd', 'e'))
6 COMPARE_OP 6 (in)
9 RETURN_VALUE
>>> dis.dis(lambda x: x in {"a","b","c","d","e"})
1 0 LOAD_FAST 0 (x)
3 LOAD_CONST 6 (frozenset({'d', 'c', 'a',
'e', 'b'}))
6 COMPARE_OP 6 (in)
9 RETURN_VALUE
Lists and sets are definitely not constants. Tuples and frozensets
aren't literals, but they can be constant. This is the optimizer
talking, though, not language semantics.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-25 10:56 +0100 |
| Message-ID | <mailman.64.1448445391.20593.python-list@python.org> |
| In reply to | #99405 |
Op 25-11-15 om 01:36 schreef Steven D'Aprano:
> On Wed, 25 Nov 2015 08:25 am, Antoon Pardon wrote:
>
>> The point is that a
>> tuple can just be loaded as a constant without needing something extra.
>
> How would one load this tuple as a constant?
>
> (myfile.read(), "%.5f" % sin(x or y))
Picking nits again. That respons was done in a context fo what I called
literals. Do you expect me to summarize the context in each response?
> The point is that *in general*, tuple so-called "literals" (what the docs
> call displays) cannot be loaded as constants. If, and only if, the tuple
> contains nothing but immutable constants e.g.
>
> (1, 2.0, None, "spam")
>
> then a sufficiently smart compiler may be able to treat that specific tuple
> as a constant/literal. But that's a special case, and cannot be generalised
> to all tuple displays.
>
> All tuple so-called "literals" e.g. (), (1, 2), (x, y, z) etc. are
> fundamentally expressions that *may* have to be built at runtime. Hence the
> word "literal" is inappropriate.
Literals are constants. So (x, y, z) is not a literal. This is what wikipedia
says:
In computer science, a literal is a notation for representing a fixed
value in source code.
Since (x, y, z) is not a fixed value, it is not a literal.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-26 04:40 +1100 |
| Message-ID | <5655f27b$0$1614$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99430 |
On Wed, 25 Nov 2015 08:56 pm, Antoon Pardon wrote:
> Since (x, y, z) is not a fixed value, it is not a literal.
Right. And therefore, (x, y, z) syntax is not syntax for a literal. Hence
why the Python docs call it a tuple display instead of a tuple literal --
no matter what x, y, z are. Even if they themselves are literals, that's
just a special case that *some* compiler versions may be able to handle.
You call this "picking nits", but if so, they are nits that are twice the
size of an an elephant and painted bright yellow. Your language arguing
about "tuple literals" seems to be based on the idea that it is usually a
constant and that cases like (x+1, y+2) is some unusual, rare corner
case -- what you call "nits". Its not. The most general case is that a
tuple display is an expression which, after evaluation, constructs a tuple.
Those few cases where the compiler can optimize it into a constant are the
nits, not the majority of cases when it can't.
In fact, it's easy to find cases even now where the compiler is
insufficiently smart to recognise all the possible optimizations available.
There's no tuple simpler than the empty tuple, but Python 3.3 at least
fails to optimize that case:
py> dis(compile("()", '', 'eval'))
1 0 BUILD_TUPLE 0
3 RETURN_VALUE
The bottom line is, *in general*, the terms "tuple literal", "list
literal", "dict literal" etc. are inappropriate and incorrect, which is why
the docs correctly distinguish them from actual literals by calling
them "displays".
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-25 19:27 +0100 |
| Message-ID | <mailman.84.1448476089.20593.python-list@python.org> |
| In reply to | #99466 |
Op 25-11-15 om 18:40 schreef Steven D'Aprano: > On Wed, 25 Nov 2015 08:56 pm, Antoon Pardon wrote: > >> Since (x, y, z) is not a fixed value, it is not a literal. > > Right. And therefore, (x, y, z) syntax is not syntax for a literal. Hence > why the Python docs call it a tuple display instead of a tuple literal -- > no matter what x, y, z are. Even if they themselves are literals, that's > just a special case that *some* compiler versions may be able to handle. > > You call this "picking nits", but if so, they are nits that are twice the > size of an an elephant and painted bright yellow. Your language arguing > about "tuple literals" seems to be based on the idea that it is usually a > constant and that cases like (x+1, y+2) is some unusual, rare corner > case -- what you call "nits". I don't know what you are talking about. The first thing I have argued is that () is a literal. Then I have expaned that to that something like (3, 5, 8) is a literal. I never argued that tuple expressions in general are literals. And one way I supported my point was with the following quote from the python language reference. Literals are notations for constant values of some built-in types. And I think that the things I argued were literals, were in fact constant values of some built-in type. > Its not. The most general case is that a > tuple display is an expression which, after evaluation, constructs a tuple. > Those few cases where the compiler can optimize it into a constant are the > nits, not the majority of cases when it can't. The nits, depend on what someone tries to argue. Since I didn't try to argue that tuple displays in general are literals but argued for very specific tuple values to be literals, you starting about tuple displays is going of on a tangent that has little to do with what I was arguing. -- Antoon
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-26 11:10 +1100 |
| Message-ID | <56564e14$0$1595$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99472 |
On Thu, 26 Nov 2015 05:27 am, Antoon Pardon wrote: > Op 25-11-15 om 18:40 schreef Steven D'Aprano: >> On Wed, 25 Nov 2015 08:56 pm, Antoon Pardon wrote: >> >>> Since (x, y, z) is not a fixed value, it is not a literal. >> >> Right. And therefore, (x, y, z) syntax is not syntax for a literal. Hence >> why the Python docs call it a tuple display instead of a tuple literal -- >> no matter what x, y, z are. Even if they themselves are literals, that's >> just a special case that *some* compiler versions may be able to handle. >> >> You call this "picking nits", but if so, they are nits that are twice the >> size of an an elephant and painted bright yellow. Your language arguing >> about "tuple literals" seems to be based on the idea that it is usually a >> constant and that cases like (x+1, y+2) is some unusual, rare corner >> case -- what you call "nits". > > I don't know what you are talking about. The first thing I have argued > is that () is a literal. How embarrassing that Python doesn't treat it as a literal, but as an expression. > And one way I supported my point was with the > following quote from the python language reference. > > Literals are notations for constant values of some built-in types. > > And I think that the things I argued were literals, were in fact > constant values of some built-in type. Since you didn't bother to provide a link, I googled for that quote, and here's a page that gives the canonical set of literals available in Python: https://docs.python.org/2/reference/lexical_analysis.html#literals https://docs.python.org/3/reference/lexical_analysis.html#literals I see strings, ints, floats, but no tuples, lists or dicts. It takes either great chutzpah or great stupidity to use the official documentation to argue in favour of a point which is contradicted by that very same documentation. The Python docs *define* "literal" to only refer to certain types. That definition is related to the grammar of Python: https://docs.python.org/3/reference/grammar.html It would be silly, wasteful and error-prone to define two sorts of tuple displays: "tuple displays where each component is a literal" "tuple displays where at least one component is not a literal" as you want to distinguish. Now obviously this is a legitimate distinction to make in some circumstances: the compiler may (or may not) be able optimise the first case in some way. But it's not a distinction that makes sense for the parser. It makes no difference to the parser whether you have (1, 2) or (1, x), it gets parsed the same way. To the parser, there is only one sort of tuple display, and it is absolutely not a literal. The terminology used for lexical analysis is the terminology used for the parser, not the peephole optimizer. All Python compilers must have a parser, and they must agree on the grammar. But optimization is implementation dependent. There is talk about adding a switch to Python to disable all peep-hole optimizations, which means whether (1, 2) gets compiled to a BUILD_CONST or a BUILD_TUPLE will depend on a runtime switch. The bottom-line is that tuples, lists, sets and dicts are compound data types, and while it is easy and convenient to talk about "tuple literals" that's sloppy language which is not supported by the language reference. When this fact is pointed out, there are multiple sensible strategies available: (1) we can acknowledge that "tuple literal" is sloppy language, and vow never to use it again; (2) we can acknowledge that "tuple literal" is sloppy language, but argue that it's convenient to use, more familiar than "tuple display", and most people will understand what you mean, and so we'll continue to use it no matter how sloppy it is; (3) or we can declare that the definition in the language reference is wrong, that we know better. What I've never seen before though is what you appear to have done: (4) Respond that the language reference, which clearly and obviously does NOT include tuples in the list of types that can be described as "literals", supports your claim that tuples are literals. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-25 13:39 -0700 |
| Message-ID | <mailman.92.1448484028.20593.python-list@python.org> |
| In reply to | #99466 |
On Wed, Nov 25, 2015 at 11:27 AM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > I don't know what you are talking about. The first thing I have argued > is that () is a literal. Then I have expaned that to that something > like (3, 5, 8) is a literal. I never argued that tuple expressions > in general are literals. And one way I supported my point was with the > following quote from the python language reference. > > Literals are notations for constant values of some built-in types. > > And I think that the things I argued were literals, were in fact > constant values of some built-in type. I believe that sentence from the docs is using "some" to mean "not all", whereas you are apparently using it to mean "any". frozenset([1,2,3]) constructs a constant value of a built-in type. Would you consider that a literal? How about tuple(1, 2+3, abs(-19))? Still a constant value of a built-in type. I think the most important word in the definition you quoted is actually "notation". It says it right there: literals are not "constant values", but notations for *expressing* constant values. The tuple display notation expresses values that may be constant but need not be. Therefore it's not a literal notation.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-25 22:05 +0100 |
| Message-ID | <mailman.97.1448485605.20593.python-list@python.org> |
| In reply to | #99466 |
Op 25-11-15 om 21:39 schreef Ian Kelly: > On Wed, Nov 25, 2015 at 11:27 AM, Antoon Pardon > <antoon.pardon@rece.vub.ac.be> wrote: >> I don't know what you are talking about. The first thing I have argued >> is that () is a literal. Then I have expaned that to that something >> like (3, 5, 8) is a literal. I never argued that tuple expressions >> in general are literals. And one way I supported my point was with the >> following quote from the python language reference. >> >> Literals are notations for constant values of some built-in types. >> >> And I think that the things I argued were literals, were in fact >> constant values of some built-in type. > > I believe that sentence from the docs is using "some" to mean "not > all", whereas you are apparently using it to mean "any". > > frozenset([1,2,3]) constructs a constant value of a built-in type. > Would you consider that a literal? I am inclined to say yes, because a sufficient intelligent compilor can compute the value and store it do be retrieved and bound to a target when needed. > How about tuple(1, 2+3, abs(-19))? Still a constant value of a built-in type. Same reasoning. > I think the most important word in the definition you quoted is > actually "notation". It says it right there: literals are not > "constant values", but notations for *expressing* constant values. And how does that make a difference? > The tuple display notation expresses values that may be constant but > need not be. Therefore it's not a literal notation. Not in general no. It doesn't imply that not any tuple display notation is a literal notation. Expression may be constant but need not be, that is no reason to claim that anything that is an expression can't be a literal. -- Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-26 09:06 +1100 |
| Message-ID | <mailman.98.1448489194.20593.python-list@python.org> |
| In reply to | #99466 |
On Thu, Nov 26, 2015 at 8:05 AM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > Op 25-11-15 om 21:39 schreef Ian Kelly: >> On Wed, Nov 25, 2015 at 11:27 AM, Antoon Pardon >> <antoon.pardon@rece.vub.ac.be> wrote: >>> I don't know what you are talking about. The first thing I have argued >>> is that () is a literal. Then I have expaned that to that something >>> like (3, 5, 8) is a literal. I never argued that tuple expressions >>> in general are literals. And one way I supported my point was with the >>> following quote from the python language reference. >>> >>> Literals are notations for constant values of some built-in types. >>> >>> And I think that the things I argued were literals, were in fact >>> constant values of some built-in type. >> >> I believe that sentence from the docs is using "some" to mean "not >> all", whereas you are apparently using it to mean "any". >> >> frozenset([1,2,3]) constructs a constant value of a built-in type. >> Would you consider that a literal? > > I am inclined to say yes, because a sufficient intelligent compilor > can compute the value and store it do be retrieved and bound to a > target when needed. Then you're using the word "literal" in a way that is flat wrong. It may be a constant, but it is not a literal. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-25 15:38 -0700 |
| Message-ID | <mailman.100.1448491150.20593.python-list@python.org> |
| In reply to | #99466 |
On Wed, Nov 25, 2015 at 2:05 PM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> Op 25-11-15 om 21:39 schreef Ian Kelly:
>> On Wed, Nov 25, 2015 at 11:27 AM, Antoon Pardon
>> <antoon.pardon@rece.vub.ac.be> wrote:
>>> I don't know what you are talking about. The first thing I have argued
>>> is that () is a literal. Then I have expaned that to that something
>>> like (3, 5, 8) is a literal. I never argued that tuple expressions
>>> in general are literals. And one way I supported my point was with the
>>> following quote from the python language reference.
>>>
>>> Literals are notations for constant values of some built-in types.
>>>
>>> And I think that the things I argued were literals, were in fact
>>> constant values of some built-in type.
>>
>> I believe that sentence from the docs is using "some" to mean "not
>> all", whereas you are apparently using it to mean "any".
>>
>> frozenset([1,2,3]) constructs a constant value of a built-in type.
>> Would you consider that a literal?
>
> I am inclined to say yes, because a sufficient intelligent compilor
> can compute the value and store it do be retrieved and bound to a
> target when needed.
I'm curious then what you think of this:
from collections import namedtuple
class Point(namedtuple("Point", "x y")): pass
Point(17, 12)
Still a constant, but not a built-in type. Would you consider that a literal?
[toc] | [prev] | [next] | [standalone]
| From | Alan Bawden <alan@csail.mit.edu> |
|---|---|
| Date | 2015-11-25 21:08 -0500 |
| Message-ID | <w2dh9k9bjhq.fsf@daphne.csail.mit.edu> |
| In reply to | #99466 |
Steven D'Aprano <steve@pearwood.info> writes:
> In fact, it's easy to find cases even now where the compiler is
> insufficiently smart to recognise all the possible optimizations available.
> There's no tuple simpler than the empty tuple, but Python 3.3 at least
> fails to optimize that case:
>
> py> dis(compile("()", '', 'eval'))
> 1 0 BUILD_TUPLE 0
> 3 RETURN_VALUE
Actually, it would be silly to compile that as a LOAD_CONST of an empty
tuple. "BUILD_TUPLE 0" doesn't allocate storage, it returns the same
empty tuple every time! In effect "BUILD_TUPLE 0" is just a global
load. A different disassembler might decide to print "BUILD_TUPLE 0" as
"LOAD_EMPTY_TUPLE".
Using LOAD_CONST would just waste space in the function's vector
of constants.
(Note that nothing in the documentation I can find actually _guarantees_
that a Python implementation will only have one unique empty tuple, but
I wouldn't be suprised if the following is nonetheless true in all
current implementations:
>>> tuple([]) is tuple([])
True
)
--
Alan Bawden
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-26 13:25 +1100 |
| Message-ID | <mailman.109.1448504727.20593.python-list@python.org> |
| In reply to | #99521 |
On Thu, Nov 26, 2015 at 1:08 PM, Alan Bawden <alan@csail.mit.edu> wrote: > (Note that nothing in the documentation I can find actually _guarantees_ > that a Python implementation will only have one unique empty tuple, but > I wouldn't be suprised if the following is nonetheless true in all > current implementations: > > >>> tuple([]) is tuple([]) > True > > ) Jython 2.5.3 (, Oct 8 2014, 03:39:09) [OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_85 Type "help", "copyright", "credits" or "license" for more information. >>> tuple([]) is tuple([]) False Python 2.7.8 (2.4.0+dfsg-3, Dec 20 2014, 13:30:46) [PyPy 2.4.0 with GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> tuple([]) is tuple([]) False ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Alan Bawden <alan@csail.mit.edu> |
|---|---|
| Date | 2015-11-25 23:27 -0500 |
| Message-ID | <w2dd1uxbd1c.fsf@daphne.csail.mit.edu> |
| In reply to | #99522 |
Chris Angelico <rosuav@gmail.com> writes: > On Thu, Nov 26, 2015 at 1:08 PM, Alan Bawden <alan@csail.mit.edu> wrote: >> (Note that nothing in the documentation I can find actually _guarantees_ >> that a Python implementation will only have one unique empty tuple, but >> I wouldn't be suprised if the following is nonetheless true in all >> current implementations: >> >> >>> tuple([]) is tuple([]) >> True >> >> ) > > Jython 2.5.3 (, Oct 8 2014, 03:39:09) > [OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_85 > Type "help", "copyright", "credits" or "license" for more information. >>>> tuple([]) is tuple([]) > False > > Python 2.7.8 (2.4.0+dfsg-3, Dec 20 2014, 13:30:46) > [PyPy 2.4.0 with GCC 4.9.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>>> tuple([]) is tuple([]) > False > > ChrisA I said I wouldn't be suprised if it was always true, but that doesn't imply that I need to be suprised if it is sometimes false! Having said that, I _am_ curious whether that remains False for various other variant expressions. "tuple([])" is actually a rather perverse way to obtain an empty tuple. How about plain "() is ()"? While "tuple([]) is tuple([])" is False is some implementations, it is still possible that "() is ()" is True in those same implementations, depending on how that compiles. An even more perverse way to obtain an empty tuple is "tuple(x for x in ())" and in fact in CPython: >>> tuple(x for x in ()) is tuple(x for x in ()) False If I had thought to try that earlier, I wouldn't have bothered making the parenthetical remark to are responding to -- because none of this has any relevance to my original point about "BUILD_TUPLE 0". -- Alan Bawden
[toc] | [prev] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2015-11-26 10:34 +0000 |
| Message-ID | <6imd5b9it55sucrcl95o95tppro7errfsi@4ax.com> |
| In reply to | #99526 |
Alan Bawden <alan@csail.mit.edu> wrote: >Chris Angelico <rosuav@gmail.com> writes: > ... >> Python 2.7.8 (2.4.0+dfsg-3, Dec 20 2014, 13:30:46) >> [PyPy 2.4.0 with GCC 4.9.2] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>>>>> tuple([]) is tuple([]) >> False > >I said I wouldn't be suprised if it was always true, but that doesn't >imply that I need to be suprised if it is sometimes false! > >Having said that, I _am_ curious whether that remains False for various >other variant expressions. "tuple([])" is actually a rather perverse >way to obtain an empty tuple. How about plain "() is ()"? ... Still false in PyPy it seems [PyPy 2.6.1 with GCC 4.9.2] on linux2 >>>> id(()) 139836165383760L >>>> id(()) 139836165383776L (Conversely, I see that unlike CPython, all PyPy's numbers have unchanging ids, even after exiting PyPy and restarting, so it seems that PyPy's numerical ids are "faked".) [PyPy 2.6.1 with GCC 4.9.2] on linux2 >>>> id(1+2j) 679900119843984469027190799480815353863L [PyPy 2.6.1 with GCC 4.9.2] on linux2 >>>> id(1+2j) 679900119843984469027190799480815353863L
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2015-11-26 12:58 +0200 |
| Message-ID | <871tbdf2o0.fsf@elektro.pacujo.net> |
| In reply to | #99549 |
Dave Farrance <df@see.replyto.invalid>: > (Conversely, I see that unlike CPython, all PyPy's numbers have > unchanging ids, even after exiting PyPy and restarting, so it seems > that PyPy's numerical ids are "faked".) What's a faked id? Marko
[toc] | [prev] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2015-11-26 11:12 +0000 |
| Message-ID | <70qd5b9lbtjlsotn7d21gor4rd67o79ou7@4ax.com> |
| In reply to | #99551 |
Marko Rauhamaa <marko@pacujo.net> wrote: >Dave Farrance <df@see.replyto.invalid>: > >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> unchanging ids, even after exiting PyPy and restarting, so it seems >> that PyPy's numerical ids are "faked".) > >What's a faked id? You can figure out what I'm getting at -- i.e. I presume that the ids are not pointers to stored numbers in memory (as with CPython) but are a translation of the numerical variable's value.
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2015-11-26 22:24 +1100 |
| Subject | Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?) |
| Message-ID | <mailman.129.1448537076.20593.python-list@python.org> |
| In reply to | #99554 |
Dave Farrance <df@see.replyto.invalid> writes: > Marko Rauhamaa <marko@pacujo.net> wrote: > > >Dave Farrance <df@see.replyto.invalid>: > > > >> (Conversely, I see that unlike CPython, all PyPy's numbers have > >> unchanging ids, even after exiting PyPy and restarting, so it seems > >> that PyPy's numerical ids are "faked".) > > > >What's a faked id? > > You can figure out what I'm getting at -- i.e. I presume that the ids > are not pointers to stored numbers in memory (as with CPython) but are > a translation of the numerical variable's value. Why refer to that as “faked”? That's what I can't figure out about what you're getting at. Perhaps Marko shares my uncomprehension. The Python language makes no promise about “pointers to stored numbers in memory” for object identity. That is an implementation detail of CPython, and is *explicitly* not promised for any other Python implementation. If you are surprised that object identity appears to have no connection with memory location, then you've made unwarranted assumptions that are explicitly warned against in the Python documentation. -- \ “Absurdity, n. A statement or belief manifestly inconsistent | `\ with one's own opinion.” —Ambrose Bierce, _The Devil's | _o__) Dictionary_, 1906 | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2015-11-26 11:50 +0000 |
| Subject | Re: Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?) |
| Message-ID | <1esd5bdujvog21u4qu6llhna5c3d573873@4ax.com> |
| In reply to | #99558 |
Ben Finney <ben+python@benfinney.id.au> wrote: >Dave Farrance <df@see.replyto.invalid> writes: > >> Marko Rauhamaa <marko@pacujo.net> wrote: >> >> >Dave Farrance <df@see.replyto.invalid>: >> > >> >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> >> unchanging ids, even after exiting PyPy and restarting, so it seems >> >> that PyPy's numerical ids are "faked".) >> > >> >What's a faked id? >> >> You can figure out what I'm getting at -- i.e. I presume that the ids >> are not pointers to stored numbers in memory (as with CPython) but are >> a translation of the numerical variable's value. > >Why refer to that as “faked”? That's what I can't figure out about what >you're getting at. Perhaps Marko shares my uncomprehension. Hence https://en.wikipedia.org/wiki/Scare_quotes
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2015-11-27 07:00 +1100 |
| Subject | Re: Object identity has no necessary connection to memory location |
| Message-ID | <mailman.152.1448568068.20593.python-list@python.org> |
| In reply to | #99562 |
Dave Farrance <df@see.replyto.invalid> writes: > >> >Dave Farrance <df@see.replyto.invalid>: > >> > > >> >> (Conversely, I see that unlike CPython, all PyPy's numbers have > >> >> unchanging ids, even after exiting PyPy and restarting, so it seems > >> >> that PyPy's numerical ids are "faked".) > > Hence > > https://en.wikipedia.org/wiki/Scare_quotes I saw the scare quotes. They still communicate your position that object identity “should” be reliably connected to the object's memory location. Either you don't hold that position, in which case your original statement was as ambiguous as this most recent one you wrote; or you do hold that position, and my response stands. -- \ “When I was little, my grandfather used to make me stand in a | `\ closet for five minutes without moving. He said it was elevator | _o__) practice.” —Steven Wright | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-27 13:17 +1100 |
| Subject | Re: Object identity has no necessary connection to memory location |
| Message-ID | <5657bd52$0$1610$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99594 |
On Fri, 27 Nov 2015 07:00 am, Ben Finney wrote: > Dave Farrance <df@see.replyto.invalid> writes: > >> >> >Dave Farrance <df@see.replyto.invalid>: >> >> > >> >> >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> >> >> unchanging ids, even after exiting PyPy and restarting, so it seems >> >> >> that PyPy's numerical ids are "faked".) >> >> Hence >> >> https://en.wikipedia.org/wiki/Scare_quotes > > I saw the scare quotes. They still communicate your position that object > identity “should” be reliably connected to the object's memory location. > > Either you don't hold that position, in which case your original > statement was as ambiguous as this most recent one you wrote; or you do > hold that position, and my response stands. Ben is right that object IDs are not promised to have any connection to object memory location. In Jython and IronPython, for example, objects appear to be given sequential IDs based on when you first ask for their ID. This is in IronPython: >>> a = [] >>> b = [] >>> id(b) 43 >>> id(a) 44 Jython is similar, except the IDs are 1 and 2 rather than 43 and 44. (All these results are subject to change, of course.) But (I think) that Dave is right that PyPy fakes IDs, in the sense that objects can be destroyed and recreated behind the scenes in PyPy without your knowledge. As I understand it, what appears to be happening is that PyPy can take Python objects, convert them to low-level machine values (destroying the Python object in the process), perform processing on the machine values, and recreate the Python object before you know it is gone. The consequence of that is that what we see as a single Python object with a fixed lifespan may in fact be multiple objects with much shorter lifespans. I'm rather partial to science fiction analogies, so here is one: when Captain Kirk uses the transporter to beam down to the Planet Of Hot Space Babes Wearing Hats With A Moral Lesson For Us All, we see Kirk on the Enterprise disappear and then re-appear on the planet a moment later. As far as we are concerned, and as far as Kirk is concerned, he has existed the whole time he was in transport. If he had an itchy nose just as he left, it's still itchy when he arrives, and if he is transported mid-thought, he finishes the thought when he arrives. There's no perception of discontinuity. But as Scotty well knows, in fact Kirk's entire body is ripped into atoms by the transporter beam, utterly destroying Kirk in the process, then transported via some oh-so-clever quantum-magical^W quantum-mechanical trick, to be reassembled at the other end. Although Kirk doesn't feel like he ceased to exist and then was re-created, in fact that's exactly what happened. One second after arriving on the planet, Kirk's body is now precisely one second old. It may not even be made of the same atoms that his former body was made of. In PyPy, an object's lifetime is not necessarily the same as the lifetime of the actual block of memory used for that object. Not only might objects be relocated in space (as they can be in IronPython and Jython) but in time as well. -- Steven
[toc] | [prev] | [next] | [standalone]
Page 5 of 10 — ← Prev page 1 … 3 4 [5] 6 7 … 10 Next page →
Back to top | Article view | comp.lang.python
csiph-web