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 9 of 10 — ← Prev page 1 … 7 8 [9] 10 Next page →
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-23 11:20 +1100 |
| Message-ID | <mailman.57.1448238043.2291.python-list@python.org> |
| In reply to | #99248 |
On Mon, Nov 23, 2015 at 11:04 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > What happened to "Please do not feed the trolls"? Hey, Norwegian researchers get hungry too you know! https://en.wikipedia.org/wiki/Troll_(research_station) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2015-11-23 12:43 +1300 |
| Message-ID | <dbf29qFoem0U1@mid.individual.net> |
| In reply to | #99228 |
Steven D'Aprano wrote: > Memoisation isn't "esoteric", it is a simple, basic and widely-used > technique used to improve performance of otherwise expensive functions. That may be true, but I don't think it's a good example of a use for a shared, mutable default value, because it's arguably an *abuse* of the default value mechanism. Whenever I want to cache function values, I use a module level variable to hold the cache. It's clearer, and it doesn't clutter the function signature with something that isn't logically a part of it at all. -- Greg
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2015-11-23 18:47 +1100 |
| Message-ID | <5652c4ac$0$1621$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99247 |
On Monday 23 November 2015 10:43, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> Memoisation isn't "esoteric", it is a simple, basic and widely-used
>> technique used to improve performance of otherwise expensive functions.
>
> That may be true, but I don't think it's a good example
> of a use for a shared, mutable default value, because
> it's arguably an *abuse* of the default value mechanism.
>
> Whenever I want to cache function values, I use a module
> level variable to hold the cache. It's clearer, and it
> doesn't clutter the function signature with something
> that isn't logically a part of it at all.
Neither solution is really fantastic, but they both get the job done.
Module level global caches have all the disadvantages of global variables.
You need a unique name for each function that uses one, it breaks
encapsulation, and it leaves you at the mercy of any code which modifies the
global.
But I agree that having the cache in the function signature is a bit smelly.
But smelly or not, it works well enough for a quick and dirty cache, and
using the function parameter list to initialise static local variables is a
moderately common thing to do. For example:
help(random.randrange)
Help on method randrange in module random:
randrange(self, start, stop=None, step=1, int=<type 'int'>, default=None,
maxwidth=9007199254740992L) method of random.Random instance
Choose a random item from range(start, stop[, step]).
I think it would be cleaner and better if Python had dedicated syntax for
declaring static local variables:
def randrange(self, start, stop=None, step=1):
static int=type(1), default=None, maxwidth=9007199254740992L
...
def func(a, b):
static cache = {}
...
Another good example of using a default mutable argument comes from Guido
himself:
https://www.python.org/doc/essays/graphs/
Note that the use of a mutable default is perfectly safe, because the
default is never modified.
--
Steve
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-23 10:40 +0000 |
| Message-ID | <n2uqau$mme$1@dont-email.me> |
| In reply to | #99255 |
On 23/11/2015 07:47, Steven D'Aprano wrote: > I think it would be cleaner and better if Python had dedicated syntax for > declaring static local variables: Interesting. So why is it that when /I/ said: > On Mon, 23 Nov 2015 12:21 am, BartC wrote: > >> But if it's used for static storage, then why not just use static >> storage? You replied with the insulting: > /head-desk ? Maybe it's my turn to bang my head on the desk. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-24 00:58 +1100 |
| Message-ID | <56531ba1$0$1597$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99262 |
On Mon, 23 Nov 2015 09:40 pm, BartC wrote:
> On 23/11/2015 07:47, Steven D'Aprano wrote:
>
>> I think it would be cleaner and better if Python had dedicated syntax for
>> declaring static local variables:
>
> Interesting. So why is it that when /I/ said:
>
> > On Mon, 23 Nov 2015 12:21 am, BartC wrote:
> >
> >> But if it's used for static storage, then why not just use static
> >> storage?
>
> You replied with the insulting:
>
> > /head-desk
>
> ?
>
> Maybe it's my turn to bang my head on the desk.
Let me steal^W borrow an idea from Galileo, and present the explanation in
the form of a dialogue between two philosophers of computer science,
Salviati and Simplicio, and a third, intelligent layman, Sagredo.
https://en.wikipedia.org/wiki/Dialogue_Concerning_the_Two_Chief_World_Systems
Salviati: Function defaults can also be used for static storage.
Simplicio: If you want static storage, why not use static storage?
Salviati: Function defaults in Python *are* static storage.
Although they not the only way to get static storage, as closures can
also be used for that purpose, they are surely the simplest way to get
static storage in Python.
Sagredo: Simplest though it might be, surely a reasonable person would
consider that using function parameters for static storage is abuse of the
feature and a global variable would be better?
Salviati: Global variables have serious disadvantages. I will agree that
using function parameters for static storage is something of a code smell,
but good enough for rough and ready code. Nevertheless, it would be good if
Python had dedicated syntax for static storage.
Simplicio: Ah-ha! Gotcha!
Salviati: No, perhaps you missed that I was referring to a hypothetical
future addition to Python, not a current feature. But even if it did exist
today, your statement misses the point that by using function defaults I
*am* using static storage. In effect, you are telling me that rather than
using static storage I should instead use static storage.
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 15:58 +0100 |
| Message-ID | <mailman.0.1448377100.20593.python-list@python.org> |
| In reply to | #99273 |
Op 23-11-15 om 14:58 schreef Steven D'Aprano:
> On Mon, 23 Nov 2015 09:40 pm, BartC wrote:
>
>> On 23/11/2015 07:47, Steven D'Aprano wrote:
>>
>>> I think it would be cleaner and better if Python had dedicated syntax for
>>> declaring static local variables:
>>
>> Interesting. So why is it that when /I/ said:
>>
>> > On Mon, 23 Nov 2015 12:21 am, BartC wrote:
>> >
>> >> But if it's used for static storage, then why not just use static
>> >> storage?
>>
>> You replied with the insulting:
>>
>> > /head-desk
>>
>> ?
>>
>> Maybe it's my turn to bang my head on the desk.
>
> Let me steal^W borrow an idea from Galileo, and present the explanation in
> the form of a dialogue between two philosophers of computer science,
> Salviati and Simplicio, and a third, intelligent layman, Sagredo.
>
> https://en.wikipedia.org/wiki/Dialogue_Concerning_the_Two_Chief_World_Systems
>
>
> Salviati: Function defaults can also be used for static storage.
>
> Simplicio: If you want static storage, why not use static storage?
>
> Salviati: Function defaults in Python *are* static storage.
>
> Although they not the only way to get static storage, as closures can
> also be used for that purpose, they are surely the simplest way to get
> static storage in Python.
>
> Sagredo: Simplest though it might be, surely a reasonable person would
> consider that using function parameters for static storage is abuse of the
> feature and a global variable would be better?
>
> Salviati: Global variables have serious disadvantages. I will agree that
> using function parameters for static storage is something of a code smell,
> but good enough for rough and ready code. Nevertheless, it would be good if
> Python had dedicated syntax for static storage.
>
> Simplicio: Ah-ha! Gotcha!
>
> Salviati: No, perhaps you missed that I was referring to a hypothetical
> future addition to Python, not a current feature. But even if it did exist
> today, your statement misses the point that by using function defaults I
> *am* using static storage. In effect, you are telling me that rather than
> using static storage I should instead use static storage.
If you really want mutable static storage, you can simulate it more cleanly with
a closure than using a default argument.
def factory():
static_dict = {}
def myfunc(a, b):
mutate static_dict as much as you like
return myfunc
myfunc = factory()
Or you can use a class of course.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-25 04:56 +1100 |
| Message-ID | <5654a4c3$0$1622$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99349 |
On Wed, 25 Nov 2015 01:58 am, Antoon Pardon wrote: > Op 23-11-15 om 14:58 schreef Steven D'Aprano: > > ... closures can also be used for [static storage] ... > If you really want mutable static storage, you can simulate it more > cleanly with a closure than using a default argument. You don't say. Thanks for letting me know what I already pointed out in the very post you responded to. It's always nice to see that people read my words with care and attention to detail. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 15:18 +0100 |
| Message-ID | <mailman.117.1448374729.2291.python-list@python.org> |
| In reply to | #99117 |
Op 20-11-15 om 02:05 schreef Steven D'Aprano:
> On Fri, 20 Nov 2015 04:30 am, BartC wrote:
>
>> On 19/11/2015 16:01, Steven D'Aprano wrote:
> [...]
>
>> The whole concept of 'mutable' default is alien to me. A default is just
>> a convenient device to avoid having to write:
>>
>> fn(0) or fn("") or fn([])
>
> Says who?
>
> Here's another use for function defaults, as static storage:
>
>
> # Ackermann's function
> def ack(m, n, _memo={}):
> key = m, n
> if key not in _memo:
> if m==0: v = n + 1
> elif n==0: v = ack(m-1, 1)
> else: v = ack(m-1, ack(m, n-1))
> _memo[key] = v
> return _memo[key]
>
>
> This is a quick and easy way to memoise a function which would otherwise be
> horribly slow. And it only works because _memo is bound to a mutable object
> once, and once only.
I think this is the worst kind of example you can give in defense for this
kind of behaviour. Because you are defining a function as having three parameters
where it really has only two. You really don't want this function to be called
with that third parameter.
Secondly, because we have decorators now, it really is not a good idea to define
your function with the memoization in the body functionality.
Thirdly your use with a default argument would go horribly wrong, should we
try to use it in the decorator definition.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 14:48 +0100 |
| Message-ID | <mailman.114.1448372919.2291.python-list@python.org> |
| In reply to | #99074 |
Op 19-11-15 om 19:20 schreef Mark Lawrence: > On 19/11/2015 17:30, BartC wrote: >> On 19/11/2015 16:01, Steven D'Aprano wrote: >>> On Fri, 20 Nov 2015 12:19 am, BartC wrote: >> >>> You know, for somebody who claims to design and implement your own >>> languages, you sometimes go to a remarkable effort to claim to be a >>> dummy. >>> You write your own interpreter, but can't understand early versus late >>> binding? I don't think so. >> >> No I don't; so? Maybe my interpreter can do its thing without being >> aware that what it's doing has been called 'late binding' or 'early >> binding' by someone else. >> >> At least its default values work as expected! >> > > Python's default values work exactly as I expect as the subject has been debated at least twice a year > on c.l.py for the 15 or so years that I've been using Python. If your expectations are clearly wrong, > that is your problem and your problem alone. Absolution to your problem is another language that does > meet all of your expectations, but as there is never a "one size fits all" the only one that I can > think of is your own, whatever that is called. Nonsense. The fact that an experienced programmer, gets to be extremely familiar with some languages and thus gets his expectations adapted, doesn't mean that there is something wrong with what newby's intuitively expect to happen. On the contrary, the regularity with how this subjects keep coming up, is an indication that this is a problem with python. -- Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 12:36 +0100 |
| Message-ID | <mailman.103.1448365049.2291.python-list@python.org> |
| In reply to | #99010 |
Op 19-11-15 om 00:22 schreef Chris Angelico:
> On Thu, Nov 19, 2015 at 10:14 AM, BartC <bc@freeuk.com> wrote:
>> On 18/11/2015 22:11, Ian Kelly wrote:
>>>
>>> On Wed, Nov 18, 2015 at 2:08 PM, fl <rxjwg98@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I have tried the below function and find that it can remember the
>>>> previous
>>>> setting value to 'val'. I think the second parameter has something on
>>>> this
>>>> effect, but I don't know the name and function of '=[]' in this
>>>> application.
>>>>
>>>> Could you explain a little to me?
>>>> Thanks,
>>>>
>>>>
>>>> def eList(val, list0=[]):
>>>> list0.append(val)
>>>> return list0
>>>> list1 = eList(12)
>>>> list1 = eList('a')
>>>
>>>
>>> The list0 parameter has a default value, which is [], an initially
>>> empty list. The default value is evaluated when the function is
>>> defined, not when it is called, so the same list object is used each
>>> time and changes to the list are consequently retained between calls.
>>
>>
>> That is really bizarre behaviour.
>>
>> So, looking at some source code, a default value for certain types is only
>> certain to be that value for the very first call of that function?
>
> On the contrary, it is certain always to be that exact object.
No, he is talking about the value. Since the object can be mutated
and thus have an other value, his statement seems correct.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-24 23:07 +1100 |
| Message-ID | <mailman.106.1448366863.2291.python-list@python.org> |
| In reply to | #99010 |
On Tue, Nov 24, 2015 at 10:36 PM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
>>> So, looking at some source code, a default value for certain types is only
>>> certain to be that value for the very first call of that function?
>>
>> On the contrary, it is certain always to be that exact object.
>
> No, he is talking about the value. Since the object can be mutated
> and thus have an other value, his statement seems correct.
With mutable objects, you can *never* depend on their values. Any time
ANY byte code gets executed, the value could change. That's why I have
never said anything about *values* of arg defaults - what you're
promised is that the *object* will be the same (so, I'm looking at its
identity, rather than its value). So it's not even certain to be that
value even for the first call:
def create_user(name, email, creation_time=datetime.datetime.now()):
Looks perfectly reasonable, right? And with late binding, sure! But
with early binding, this will probably NEVER be what you want. But
what if you have an object that always stringifies the current time?
class Now:
def __init__(self, fmt):
self.fmt = fmt
def __repr__(self):
return datetime.datetime.now().strftime(self.fmt)
def create_user(name, email, creation_time=Now("%Y%m%d%H%M%S")):
Voila! An object whose value dynamically represents the notion of
"Now", but where it makes fine sense to have the same object used
every time. Since the value changes every second, it (probably) won't
even have that value for the first call, yet the behaviour will be
correct.
His statement is still incorrect, in that the value is NEVER certain,
but the identity is ALWAYS certain. It happens to be the case for the
one example of lists that get mutated only in the function. It's about
as accurate as the statement that Python is pass-by-value for integers
but pass-by-reference for dictionaries.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 13:48 +0100 |
| Message-ID | <mailman.110.1448369310.2291.python-list@python.org> |
| In reply to | #99010 |
Op 24-11-15 om 13:07 schreef Chris Angelico: > On Tue, Nov 24, 2015 at 10:36 PM, Antoon Pardon > <antoon.pardon@rece.vub.ac.be> wrote: >>>> So, looking at some source code, a default value for certain types is only >>>> certain to be that value for the very first call of that function? >>> >>> On the contrary, it is certain always to be that exact object. >> >> No, he is talking about the value. Since the object can be mutated >> and thus have an other value, his statement seems correct. > > With mutable objects, you can *never* depend on their values. Any time > ANY byte code gets executed, the value could change. That's why I have > never said anything about *values* of arg defaults. Yes you have. You haven't mentioned them yourself. But when you contradict the statement of someone and that person talked about values, then in contradicting that statement you said something about values. You then switching to talking about objects, just gives the impression that object is a synonym for value. -- Antoon
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2015-11-24 14:57 +0200 |
| Message-ID | <874mgbpnb5.fsf@elektro.pacujo.net> |
| In reply to | #99324 |
Antoon Pardon <antoon.pardon@rece.vub.ac.be>: > You then switching to talking about objects, just gives the impression > that object is a synonym for value. It isn't? Marko
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2015-11-24 06:18 -0800 |
| Message-ID | <486929d1-4caa-403c-89e6-c45d7b447f98@googlegroups.com> |
| In reply to | #99325 |
On Tuesday, November 24, 2015 at 7:57:54 AM UTC-5, Marko Rauhamaa wrote:
> Antoon Pardon <antoon.pardon@rece.vub.ac.be>:
>
> > You then switching to talking about objects, just gives the impression
> > that object is a synonym for value.
>
> It isn't?
We are tangled up in another terminology conflict. The word "value" is
being used in two different senses. It's understandable that this results
in confusion. Neither use is incorrect, we just have to understand that
there are multiple meanings, and clarify where the meaning is uncertain.
1) In English, "value" means something like, what is this equal to? There
isn't another good word to use in place of "value" here. We might awkwardly
use the word "equivalence" as a synonym. I'll use the word "evalue" (short
for "equal value" or "equivalence value" or "English value"). The ==
operator is useful for testing whether two values are "the same evalue".
In this sense, the expression "[]" always evaluates to the same value,
an empty list:
>>> a = []
>>> b = []
>>> a == b
True
2) In Python, "value" means, what object does a name refer to, or what
object did an evaluation produce. We could use "referent" as a
synonym for this meaning. The Python operator "is" tests whether two
values are the same referent, or, the same object. In this sense, "[]"
always evaluates to a different value, because you get a new empty list
each time:
>>> a = []
>>> b = []
>>> a is b
False
Mutable objects are complicated because the same referent (object) can
change its evalue over time.
The confusion over mutable default arguments arises because the
defaulted argument always gets the same referent, but it might not
always be the same evalue.
--Ned.
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-24 14:43 +0000 |
| Message-ID | <n31suk$hi5$1@dont-email.me> |
| In reply to | #99338 |
On 24/11/2015 14:18, Ned Batchelder wrote: > On Tuesday, November 24, 2015 at 7:57:54 AM UTC-5, Marko Rauhamaa wrote: >> Antoon Pardon <antoon.pardon@rece.vub.ac.be>: >> >>> You then switching to talking about objects, just gives the impression >>> that object is a synonym for value. >> >> It isn't? > 1) In English, "value" means something like, what is this equal to? There > isn't another good word to use in place of "value" here. We might awkwardly > use the word "equivalence" as a synonym. I'll use the word "evalue" (short > for "equal value" or "equivalence value" or "English value"). The == > operator is useful for testing whether two values are "the same evalue". > In this sense, the expression "[]" always evaluates to the same value, > an empty list: > > >>> a = [] > >>> b = [] > >>> a == b > True > > 2) In Python, "value" means, what object does a name refer to, or what > object did an evaluation produce. We could use "referent" as a > synonym for this meaning. The Python operator "is" tests whether two > values are the same referent, or, the same object. In this sense, "[]" > always evaluates to a different value, because you get a new empty list > each time: > > >>> a = [] > >>> b = [] > >>> a is b > False And [] is [] gives False too! For my own benefit, I use the term Handle when shared values are involved. It comes from the use of file handles (what you get in some languages when you open or create a file) which everyone can understand: * If you copy handle F to G like in an assignment, it obviously doesn't copy the contents of the file, just the handle. * If I compare the contents of files F and H, they might be the same, but they are not necessarily the same file. * If F and G are the same handle, then if I update a file via F, I will see the same change via handle G. The main difference is that when F and G go out of scope and the handles disappear, the file hopefully still exists! (And ideally the file is first closed via one of the handles.) From your example, the syntax '[]' is roughly equivalent to 'create_empty_file()' in my analogy. (I don't really want to get back to default arguments, but that would extend to: def fn(a = create_empty_file()): which makes it easier to appreciate the implications of 'early' and 'late' binding. But I still think that reads as though you get a fresh, empty file each time.) -- Bartc -- bartc
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-25 01:54 +1100 |
| Message-ID | <mailman.124.1448376894.2291.python-list@python.org> |
| In reply to | #99345 |
On Wed, Nov 25, 2015 at 1:43 AM, BartC <bc@freeuk.com> wrote: > It comes from the use of file handles (what you get in some languages when > you open or create a file) which everyone can understand: > > * If you copy handle F to G like in an assignment, it obviously doesn't copy > the contents of the file, just the handle. > > * If I compare the contents of files F and H, they might be the same, but > they are not necessarily the same file. > > * If F and G are the same handle, then if I update a file via F, I will see > the same change via handle G. > > The main difference is that when F and G go out of scope and the handles > disappear, the file hopefully still exists! (And ideally the file is first > closed via one of the handles.) I would recommend picking a different example, actually. An open file (the resource) is different from the file that actually exists on the disk. You can open a file for reading three times, and barring access conflicts etc, you'll get three distinct open-file-objects (file handles, etc), with separate read pointers, and advancing the file pointer of one has no effect on the other two. Plus there are other considerations like the notion of duplicating file handles, force-duplicating file handles (sometimes called "dup2"), files that no longer exist on disk but only in memory, files that exist on disk but no longer have any file names, and so on. Files are way WAY more complicated than you want to dig into here. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 16:10 +0100 |
| Message-ID | <mailman.3.1448377833.20593.python-list@python.org> |
| In reply to | #99338 |
Op 24-11-15 om 15:18 schreef Ned Batchelder: > 2) In Python, "value" means, what object does a name refer to, or what > object did an evaluation produce. I don't think this is correct because that would imply that objects don't change values (since the value would be the object). When a list is mutated, it's value has changed. That is how the word is generally used in python. -- Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2015-11-24 07:27 -0800 |
| Message-ID | <3589d016-f9ba-4217-83ea-4041ac085230@googlegroups.com> |
| In reply to | #99352 |
On Tuesday, November 24, 2015 at 10:10:51 AM UTC-5, Antoon Pardon wrote: > Op 24-11-15 om 15:18 schreef Ned Batchelder: > > > 2) In Python, "value" means, what object does a name refer to, or what > > object did an evaluation produce. > > I don't think this is correct because that would imply that objects don't > change values (since the value would be the object). Sorry, I should have been more precise. Python documentation suffers from this two-meaning world also. There are places where "value" is used in this second sense, perhaps more places than you realize. I know when I wrote "Python Names and Values", I meant it in this second sense. When you think people's claims about values, or understanding of values are incorrect, take a moment to decipher which of these two meanings they are likely using, and see if it more sense. > When a list is mutated, it's value has changed. That is how the word is > generally used in python. I don't know about "generally." It's true that when a list is mutated, it is the same referent, but now has a different evalue. That's what it means to be mutable. It's also true that the Python docs, being written in English, will use the "evalue" sense of the word, mixed together with the "referent" sense of the word. And yes, this can be confusing. --Ned.
[toc] | [prev] | [next] | [standalone]
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
|---|---|
| Date | 2015-11-24 17:25 +0000 |
| Message-ID | <mailman.18.1448385928.20593.python-list@python.org> |
| In reply to | #99355 |
On 24 November 2015 at 15:27, Ned Batchelder <ned@nedbatchelder.com> wrote: > On Tuesday, November 24, 2015 at 10:10:51 AM UTC-5, Antoon Pardon wrote: >> Op 24-11-15 om 15:18 schreef Ned Batchelder: >> >> > 2) In Python, "value" means, what object does a name refer to, or what >> > object did an evaluation produce. >> >> I don't think this is correct because that would imply that objects don't >> change values (since the value would be the object). > > Sorry, I should have been more precise. Python documentation suffers from > this two-meaning world also. There are places where "value" is used in > this second sense, perhaps more places than you realize. I know when I > wrote "Python Names and Values", I meant it in this second sense. Hi Ned, I read your talk on this subject which was linked to further up in the thread and it is excellent so thanks for that. I forwarded it to a colleague for inspiration in our own introductory programming (with Python) teaching unit. However when I read it and imagined explaining it to our students I found myself wanting to adjust the terminology. I would not use the word value in the way that you suggest. Rather I would want to contrast "names" (or "references"), "objects" and "values". I think that many things can be expressed more cleanly with these terms and I think it corresponds more to the way in which I see Python programmers use these terms. So I would say that an object has a value. Immutable objects have unchanging values but the value of mutable objects can change. The expression "a is b" determines whether or not a and b are bound to the same object whereas "a == b" determines if the objects bound to a and b have the same value. To copy an object is to create a new object having the same value as the copied object. To mutate an object is to change its value etc. Earlier in this thread you said: """ In Python, a default value expression for a function argument is evaluated only once, when the function is defined. That value (in this case, the actual list) is stored with the function. The expression is not stored, the value of the expression is. That value (the actual list) is supplied as the value of the argument if no other value is supplied. If you modify that value in the function, the value is modified, and used again at the next function call. """ I think that's a good example of where it would be clearer to distinguish between objects and values, rather than using the word value for both. In particular what is stored with the function is the *object* that results from the default value expression. The *value* of that object may change if it is mutated but it will still be the same object each time the function is called (without a corresponding argument being passed). -- Oscar
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2015-11-24 09:35 -0800 |
| Message-ID | <51dc19ec-9ea0-4b37-bd66-6ebdacc83d87@googlegroups.com> |
| In reply to | #99370 |
On Tuesday, November 24, 2015 at 12:25:54 PM UTC-5, Oscar Benjamin wrote: > On 24 November 2015 at 15:27, Ned Batchelder <ned@nedbatchelder.com> wrote: > > On Tuesday, November 24, 2015 at 10:10:51 AM UTC-5, Antoon Pardon wrote: > >> Op 24-11-15 om 15:18 schreef Ned Batchelder: > >> > >> > 2) In Python, "value" means, what object does a name refer to, or what > >> > object did an evaluation produce. > >> > >> I don't think this is correct because that would imply that objects don't > >> change values (since the value would be the object). > > > > Sorry, I should have been more precise. Python documentation suffers from > > this two-meaning world also. There are places where "value" is used in > > this second sense, perhaps more places than you realize. I know when I > > wrote "Python Names and Values", I meant it in this second sense. > > Hi Ned, I read your talk on this subject which was linked to further > up in the thread and it is excellent so thanks for that. I forwarded > it to a colleague for inspiration in our own introductory programming > (with Python) teaching unit. > > However when I read it and imagined explaining it to our students I > found myself wanting to adjust the terminology. I would not use the > word value in the way that you suggest. Rather I would want to > contrast "names" (or "references"), "objects" and "values". I think > that many things can be expressed more cleanly with these terms and I > think it corresponds more to the way in which I see Python programmers > use these terms. > > So I would say that an object has a value. Immutable objects have > unchanging values but the value of mutable objects can change. The > expression "a is b" determines whether or not a and b are bound to the > same object whereas "a == b" determines if the objects bound to a and > b have the same value. To copy an object is to create a new object > having the same value as the copied object. To mutate an object is to > change its value etc. > > Earlier in this thread you said: > """ > In Python, a default value expression > for a function argument is evaluated only once, when the function is defined. > That value (in this case, the actual list) is stored with the function. The > expression is not stored, the value of the expression is. That value (the > actual list) is supplied as the value of the argument if no other value is > supplied. If you modify that value in the function, the value is modified, > and used again at the next function call. > """ > I think that's a good example of where it would be clearer to > distinguish between objects and values, rather than using the word > value for both. In particular what is stored with the function is the > *object* that results from the default value expression. The *value* > of that object may change if it is mutated but it will still be the > same object each time the function is called (without a corresponding > argument being passed). > > -- > Oscar Oscar, thanks for the thoughtful comments. I agree that using "object" for the result of an expression, and for the referent of a name, would go some ways to clarifying things. Perhaps the Python world uses "value" less to mean "object" than I am thinking. But we do talk about "the value of an expression", and "what value does X have," and so on. --Ned.
[toc] | [prev] | [next] | [standalone]
Page 9 of 10 — ← Prev page 1 … 7 8 [9] 10 Next page →
Back to top | Article view | comp.lang.python
csiph-web