Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98999 > unrolled thread

What is a function parameter =[] for?

Started byfl <rxjwg98@gmail.com>
First post2015-11-18 13:08 -0800
Last post2015-11-25 03:11 +1100
Articles 18 on this page of 198 — 24 participants

Back to article view | Back to comp.lang.python


Contents

  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 10 of 10 — ← Prev page 1 … 8 9 [10]


#99381

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-24 20:13 +0200
Message-ID<877fl78dvh.fsf@elektro.pacujo.net>
In reply to#99373
Ned Batchelder <ned@nedbatchelder.com>:

> 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.

There are all kinds of uses (Google: python "value of"):

  "How to get the value of a variable given its name in a string"

  "The value of some objects can change. Objects whose value can change
  are said to be mutable"

  "I'm taking the return value of one function and using it as the
  argument of another function"

  "Don't get confused — name on the left, value on the right"

  "We can print the current value of the dictionary in the usual way"

  "A return statement ends the execution of the function call and
  "returns" the result, i.e. the value of the expression following the
  return keyword, to the caller"

  "When we ask python what the value of x > 5 is, we get False"

  "To display the value of a variable, you can use a print statement"

  "Get a value of a specified key"


Personally, I don't like the "official" Python usage:

   Objects whose value can change are said to be mutable

I would prefer this wording:

   Objects whose inner state can change are said to be mutable


Marko

[toc] | [prev] | [next] | [standalone]


#99383

FromSteven D'Aprano <steve@pearwood.info>
Date2015-11-25 05:33 +1100
Message-ID<5654ad75$0$1583$c3e8da3$5496439d@news.astraweb.com>
In reply to#99381
On Wed, 25 Nov 2015 05:13 am, Marko Rauhamaa wrote:

> Personally, I don't like the "official" Python usage:
> 
> Objects whose value can change are said to be mutable
> 
> I would prefer this wording:
> 
> Objects whose inner state can change are said to be mutable


I see your point, but "inner state" might not be related to the object's
externally visible value.

For example, dicts have an inner state which can vary, even when their value
remains the same:

# using Python 3.3

py> d = {-1: "a", -2: "b"}
py> e = {-2: "b", -1: "a"}
py> d == e
True
py> print(d, e)
{-2: 'b', -1: 'a'} {-1: 'a', -2: 'b'}

The two dicts have the same value, but their inner state is slightly
different, which is why they print in different order.

Likewise for lists:


py> a = []
py> for i in range(100):
...     a.append(1)
...
py> b = [1]*100
py> a == b
True
py> sys.getsizeof(a) == sys.getsizeof(b)
False



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#99390

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-24 21:17 +0200
Message-ID<8737vv8ax5.fsf@elektro.pacujo.net>
In reply to#99383
Steven D'Aprano <steve@pearwood.info>:

> On Wed, 25 Nov 2015 05:13 am, Marko Rauhamaa wrote:
>> I would prefer this wording:
>> 
>> Objects whose inner state can change are said to be mutable
>
> I see your point, but "inner state" might not be related to the
> object's externally visible value.

The inner state is indeed inaccessible. We cannot determine immutability
by testing, but we *can* determine mutability (if we're lucky).

> For example, dicts have an inner state which can vary, even when their value
> remains the same:
>
> # using Python 3.3
>
> py> d = {-1: "a", -2: "b"}
> py> e = {-2: "b", -1: "a"}
> py> d == e
> True
> py> print(d, e)
> {-2: 'b', -1: 'a'} {-1: 'a', -2: 'b'}
>
> The two dicts have the same value, but their inner state is slightly
> different, which is why they print in different order.

I'd say an object o is mutable (at least) if it has got a method m such
that:

    before = o.m()
    # any intervening code that does not reassign o
    after = o.m()
    before == after
    => False


Marko

[toc] | [prev] | [next] | [standalone]


#99362

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-11-24 11:27 -0500
Message-ID<mailman.11.1448382470.20593.python-list@python.org>
In reply to#99338
On Tue, 24 Nov 2015 16:10:27 +0100, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> declaimed the following:

>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.

	Probably adding jet fuel to the embers but...

	I'd consider "value" to be the /current state/ of the object

	A mutable object has changeable internal state, but remains the same
object.

	Integers, floats, strings are fixed with to the state at time of
creation. Dictionaries, lists, class instances, OTOH, are not fixed to the
state at time of creation.

	Default parameter link a name to an object at the time of definition
but do not "fix" the state of the object.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#99406

FromSteven D'Aprano <steve@pearwood.info>
Date2015-11-25 11:39 +1100
Message-ID<5655035c$0$1609$c3e8da3$5496439d@news.astraweb.com>
In reply to#99338
On Wed, 25 Nov 2015 01:18 am, Ned Batchelder wrote:

> In English, "value" means something like, what is this equal to? 
> There isn't another good word to use in place of "value" here.

There are many different meanings for the English noun "value" (Websters
1913 dictionary includes ten), but I think that the only one that is
relevant is:

"Any particular quantitative determination".

although since we're not just talking about numbers even that needs to be
modified to allow qualitative as well as quantitative determination. E.g.
the value of a particular str object is the string "foobarbaz".


> 2) In Python, "value" means, what object does a name refer to, or what
> object did an evaluation produce.

I don't think that is correct.

The Docs clearly say that "value" is an attribute or quality of objects, not
a synonym for "object":

Quote: "Every object has an identity, a type and a value."

https://docs.python.org/2/reference/datamodel.html#objects-values-and-types

If the docs are a bit inconsistent in ensuring that "value" means something
that objects *have* rather than something that objects *are*, that may be
something to fix.



> 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.


I'm not sure what value [ha, see what I did there?!] there is in inventing
two new words for things that we already have standard terms for.

"Referent" is just a funny way of saying "object", and "evalue" is just a
misspelling of "value".




-- 
Steven

[toc] | [prev] | [next] | [standalone]


#99407

FromLaura Creighton <lac@openend.se>
Date2015-11-25 01:55 +0100
Message-ID<mailman.42.1448412968.20593.python-list@python.org>
In reply to#99406
In a message of Wed, 25 Nov 2015 11:39:54 +1100, "Steven D'Aprano" writes:
>I'm not sure what value [ha, see what I did there?!] there is in inventing
>two new words for things that we already have standard terms for.

Done correctly, you can get clarity.

>"Referent" is just a funny way of saying "object", and "evalue" is just a
>misspelling of "value".

If I had a time machine, I would go back to early days of Python and
ban the use of the term 'assignment' and 'value' both.  I would insist
that the term 'binding' be used instead, though if you want to use the
verb refer, to be synonymous with bind, well, I think that would work.
(If not, next trip with the time machine, I ban that one as well.)
Then you make it perfectly clear that what are bound are _objects_
not values (or evalues).  The object has an evalue, but it is the
object that is bound.

It is crystal clear than people on this list mean very different
things when they use the term 'value', and every one of them thinks
that Python agrees with them.  Cutting this knot may require a new
word.

Laura

[toc] | [prev] | [next] | [standalone]


#99410 — A name refers to an object, an object has a value, equality compares values (was: What is a function parameter =[] for?)

FromBen Finney <ben+python@benfinney.id.au>
Date2015-11-25 13:17 +1100
SubjectA name refers to an object, an object has a value, equality compares values (was: What is a function parameter =[] for?)
Message-ID<mailman.45.1448417879.20593.python-list@python.org>
In reply to#99406
Laura Creighton <lac@openend.se> writes:

> If I had a time machine, I would go back to early days of Python and
> ban the use of the term 'assignment' and 'value' both. I would insist
> that the term 'binding' be used instead, though if you want to use the
> verb refer, to be synonymous with bind, well, I think that would work.

+1

> (If not, next trip with the time machine, I ban that one as well.)

I've never been able to remember where the keys are kept; I'm sure they
keep being moved by previous drivers.

> It is crystal clear than people on this list mean very different
> things when they use the term 'value', and every one of them thinks
> that Python agrees with them. Cutting this knot may require a new
> word.

Indeed, in the past I used the term “value” as synonymous (in Python
context) with the term “object”. I have become convinced through this
discussion that I should no longer use the terms that way.

Instead, an object *has* a value at a point in time; if the object's
value can change, we say the object is mutable.

The syntax for literals describe a value, but the object once created
may change its value.

Typically, ‘is’ compares object identity; ‘==’ compares object value.

The concepts are distinct, so I apologise for misleadingly conflating
them in my terminology.

-- 
 \             “Skepticism is the highest duty and blind faith the one |
  `\               unpardonable sin.” —Thomas Henry Huxley, _Essays on |
_o__)                                   Controversial Questions_, 1889 |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#99416 — Re: A name refers to an object, an object has a value, equality compares values

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-25 08:44 +0200
SubjectRe: A name refers to an object, an object has a value, equality compares values
Message-ID<87egfe7f3m.fsf@elektro.pacujo.net>
In reply to#99410
Ben Finney <ben+python@benfinney.id.au>:

> Indeed, in the past I used the term “value” as synonymous (in Python
> context) with the term “object”. I have become convinced through this
> discussion that I should no longer use the terms that way.
>
> [...]
>
> The concepts are distinct, so I apologise for misleadingly conflating
> them in my terminology.

I don't think the meaning of the word "value" can be restricted in that
way. Let's try to "refactor" the examples I had found in the wild:

  "How to get the value of a variable given its name in a string"
  => How to get the object a variable is bound to given the name of the
     variable in a string

  "The value of some objects can change. Objects whose value can change
  are said to be mutable"
  [no change]

  "I'm taking the return value of one function and using it as the
  argument of another function"
  => I'm taking the return object of one function and using it as the
     argument of another function

  "Don't get confused — name on the left, value on the right"
  => Don't get confused — name on the left, object on the right

  "We can print the current value of the dictionary in the usual way"
  [no change]

  "A return statement ends the execution of the function call and
  "returns" the result, i.e. the value of the expression following the
  return keyword, to the caller"
  => A return statement ends the execution of the function call and
     "returns" the result, i.e. the resulting object of the expression
     following the return keyword, to the caller

  "When we ask python what the value of x > 5 is, we get False"
  => When we ask python what the resulting object of x > 5 is, we get
     False

  "To display the value of a variable, you can use a print statement"
  => To display the value of the object a variable is bound to, you can
     use a print statement

  "Get a value of a specified key"
  => Get an image object of a specified key

In a word, it's a lost cause.

It is actually somewhat comical how Python documentation tries, but
fails, to maintain terminological orthodoxy:

  A mapping object maps hashable values to arbitrary objects. [...]

  A dictionary’s keys are almost arbitrary values. Values that are not
  hashable, that is, values containing lists, dictionaries or other
  mutable types (that are compared by value rather than by object
  identity) may not be used as keys.

  [...]

  Dictionaries can be created by placing a comma-separated list of
  key: value pairs within braces

  [...]

  The first object of each item becomes a key in the new dictionary, and
  the second object the corresponding value. If a key occurs more than
  once, the last value for that key becomes the corresponding value in
  the new dictionary.

  [...]

  d[key] = value
    Set d[key] to value.

  [...]

  values()
    Return a new view of the dictionary’s values.

  <URL: https://docs.python.org/3/library/stdtypes.html?highlig
  ht=value#mapping-types-dict>


Marko

[toc] | [prev] | [next] | [standalone]


#99420 — Re: A name refers to an object, an object has a value, equality compares values

FromChris Angelico <rosuav@gmail.com>
Date2015-11-25 19:27 +1100
SubjectRe: A name refers to an object, an object has a value, equality compares values
Message-ID<mailman.55.1448440070.20593.python-list@python.org>
In reply to#99416
On Wed, Nov 25, 2015 at 5:44 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> I don't think the meaning of the word "value" can be restricted in that
> way. Let's try to "refactor" the examples I had found in the wild:
>
>   "How to get the value of a variable given its name in a string"
>   => How to get the object a variable is bound to given the name of the
>      variable in a string
>
>   "The value of some objects can change. Objects whose value can change
>   are said to be mutable"
>   [no change]

Agree with these.

>   "I'm taking the return value of one function and using it as the
>   argument of another function"
>   => I'm taking the return object of one function and using it as the
>      argument of another function
>
>   "Don't get confused — name on the left, value on the right"
>   => Don't get confused — name on the left, object on the right
>
>   "A return statement ends the execution of the function call and
>   "returns" the result, i.e. the value of the expression following the
>   return keyword, to the caller"
>   => A return statement ends the execution of the function call and
>      "returns" the result, i.e. the resulting object of the expression
>      following the return keyword, to the caller
>
>   "When we ask python what the value of x > 5 is, we get False"
>   => When we ask python what the resulting object of x > 5 is, we get
>      False

These are all talking about the value of an expression. Expressions
have values, just as objects do; in Python, evaluation of an
expression results in some object whose value is the value of the
expression. In many cases, the definition of an expression's value has
nothing to do with object identity, only value - for instance, when
you call methods on strings such as lower(), center(), or format(),
they're required to return a string object with a particular value,
but there's no rule about that object's identity. On the CPython that
I tried:

$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> s = "hello world"
>>> s.lower() is s
False
>>> s.center(len(s)) is s
True
>>> s.format() is s
True

A compliant Python would be allowed to return either True or False for
each of these; but if you change the 'is' checks to '==', they have to
all be True, because the given operations don't change the string's
*value* at all. Same with integer arithmetic, string concatenation,
and so on.

>   "To display the value of a variable, you can use a print statement"
>   => To display the value of the object a variable is bound to, you can
>      use a print statement

This one was probably talking to a new programmer. It's often not
worth going into extreme detail early on; being slightly sloppy with
terminology isn't a problem when what you're really saying is just
"use print to find out what your program is doing".

>   "Get a value of a specified key"
>   => Get an image object of a specified key

Another one that's looking at the value of an expression. In this
case, though, the value is defined based on object identity as well as
value, so I suppose you could word this as:

"Get the object referenced by a specified key"

if you wanted to be pedantic. But dictionaries are defined as mapping
keys to values, and the value associated with a key happens to be
represented by some object.

> In a word, it's a lost cause.

Doesn't need to be.

> It is actually somewhat comical how Python documentation tries, but
> fails, to maintain terminological orthodoxy:
>
>   A mapping object maps hashable values to arbitrary objects. [...]
>
>   A dictionary’s keys are almost arbitrary values. Values that are not
>   hashable, that is, values containing lists, dictionaries or other
>   mutable types (that are compared by value rather than by object
>   identity) may not be used as keys.

No, this is strictly correct. A dictionary's keys are defined by
values, not objects. The dict retains references to the objects used,
but it's equality, not identity, that defines the match.

>>> class S(str): pass
...
>>> k1 = S("hello")
>>> k2 = S("hello")
>>> k1 is k2
False
>>> k1 == k2
True
>>> d = {k1: 42}
>>> d[k2]
42

The *value* of the setter key is what the dictionary cares about,
although it does retain the identity of the object:

>>> next(iter(d)) is k1
True

>   Dictionaries can be created by placing a comma-separated list of
>   key: value pairs within braces
>
>   [...]
>
>   The first object of each item becomes a key in the new dictionary, and
>   the second object the corresponding value. If a key occurs more than
>   once, the last value for that key becomes the corresponding value in
>   the new dictionary.
>
>   [...]
>
>   d[key] = value
>     Set d[key] to value.
>
>   [...]
>
>   values()
>     Return a new view of the dictionary’s values.
>
>   <URL: https://docs.python.org/3/library/stdtypes.html?highlig
>   ht=value#mapping-types-dict>

These are all talking about the other sense of "value" - the way
expressions yield values. If you were to build a binary tree in
Python, you'd have a similar concept of the nodes' "values", which
would again be represented by Python objects; but to the tree, they're
values. It's equivocation on the word "value", but I don't know of a
better word for it (I've sometimes used "payload", but that has its
own issues).

ChrisA

[toc] | [prev] | [next] | [standalone]


#99428

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2015-11-25 10:36 +0100
Message-ID<mailman.62.1448444207.20593.python-list@python.org>
In reply to#99406
Op 25-11-15 om 01:55 schreef Laura Creighton:
> In a message of Wed, 25 Nov 2015 11:39:54 +1100, "Steven D'Aprano" writes:
>> I'm not sure what value [ha, see what I did there?!] there is in inventing
>> two new words for things that we already have standard terms for.
> Done correctly, you can get clarity.
>
>> "Referent" is just a funny way of saying "object", and "evalue" is just a
>> misspelling of "value".
> If I had a time machine, I would go back to early days of Python and
> ban the use of the term 'assignment' and 'value' both.  I would insist
> that the term 'binding' be used instead, though if you want to use the
> verb refer, to be synonymous with bind, well, I think that would work.
> (If not, next trip with the time machine, I ban that one as well.)
> Then you make it perfectly clear that what are bound are _objects_
> not values (or evalues).  The object has an evalue, but it is the
> object that is bound.

Not far enough back. Since there are older languages with the same
assignment semantics as python, you should at least go so far.
Otherwise you would get the argument why one shouldn't use the
word assignment in python, while other languages use it for the
same kind of thing.

-- 
Antoon.

[toc] | [prev] | [next] | [standalone]


#99440

FromJussi Piitulainen <harvest@should.be.invalid>
Date2015-11-25 13:39 +0200
Message-ID<lf5a8q2xq7z.fsf@ling.helsinki.fi>
In reply to#99428
Antoon Pardon writes:

> Op 25-11-15 om 01:55 schreef Laura Creighton:

>> If I had a time machine, I would go back to early days of Python and
>> ban the use of the term 'assignment' and 'value' both.  I would
>> insist that the term 'binding' be used instead, though if you want to
>> use the verb refer, to be synonymous with bind, well, I think that
>> would work.  (If not, next trip with the time machine, I ban that one
>> as well.)  Then you make it perfectly clear that what are bound are
>> _objects_ not values (or evalues).  The object has an evalue, but it
>> is the object that is bound.
>
> Not far enough back. Since there are older languages with the same
> assignment semantics as python, you should at least go so far.

Back to 1958 or so when Lisp was LISP and the association of names with
whatever they named was represented as "association lists" (singly
linked lists of key-keyed pairs), or possibly as "property lists"
(singly linked lists with alternative elements being the key and the
keyed). Other arrangements are known. Such a list would have the role
that namespaces have in Python. One could replace the named thing. Then
the name would be associated with something else when that same list
still served as the namespace.

This node (point b) in reminiscenses by John McCarthy himself refers to
the "pseudo-functions" rplaca and rplacd that can replace components of
these data structures (the "a" and "d" refer to the "address part" and
the "decrement part" of a register).
<http://www-formal.stanford.edu/jmc/history/lisp/node4.html>

In point d, McCarthy refers to variables as variables; I'm sure this
would go back to Church and 1940's at least, so I expect they used this
word already back then. But the ability to store new content to the data
structure that associates variables with stuff must be newer. I think it
was new with LISP.

I don't know if assignment was originally called assignment, or whether
the association of names with stuff was originally called binding, but
this terminology is old enough that I've known binding and assignment of
variables by these names for as long as I can remember, with more or
less the semantics that Python now uses. "Rebinding" I've not known
elsewhere.

> Otherwise you would get the argument why one shouldn't use the
> word assignment in python, while other languages use it for the
> same kind of thing.

I think the argument is just that: One shouldn't use otherwise standard
terminology in connection with Python. (With the possible exception of
the Python language reference.) Because people might be confused. (Other
people's confusion doesn't matter. And does the terminology ban even
help?) Also, C is different! (Only C matters. Because no reasons.)

That became snarky in the end. The trouble is that my mental model and
terminology serve me really well when I work in Python.

[toc] | [prev] | [next] | [standalone]


#99444

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-25 14:48 +0200
Message-ID<87egfent2i.fsf@elektro.pacujo.net>
In reply to#99440
Jussi Piitulainen <harvest@should.be.invalid>:

> In point d, McCarthy refers to variables as variables; I'm sure this
> would go back to Church and 1940's at least, so I expect they used
> this word already back then. But the ability to store new content to
> the data structure that associates variables with stuff must be newer.
> I think it was new with LISP.

As far as the words "variable" and "binding" go, they are present in
lambda calculus (1929 and on):

   Lambda calculus (also written as λ-calculus) is a formal system in
   mathematical logic for expressing computation based on function
   abstraction and application using variable binding and substitution.
   First formulated by Alonzo Church [...]

   [...]

   The abstraction operator, λ, is said to bind its variable wherever it
   occurs in the body of the abstraction. Variables that fall within the
   scope of an abstraction are said to be bound. All other variables are
   called free.

   <URL: https://en.wikipedia.org/wiki/Lambda_calculus>

In lambda calculus, variables are formal markers that are used during
substitution during reduction (ie, evaluation).

If we were to apply the thinking to Python, we could have:

   def f(x):
       return (x + 3) * x

   def g(x):
       return x * 2 - math.sqrt(x)

Now the Python expression

   f(g(7))

could be reduced as follows:

   f(g(7))
   =>
   (g(7) + 3) * g(7)
   =>
   ((7 * 2 - math.sqrt(7)) + 3) * (7 * 2 - math.sqrt(7))
   =>
   (7 * 2 - 2.6457513110645907) + 3 * (7 * 2 - 2.6457513110645907)
   =>
   [etc]
   
That is, binding/substitution is syntactic/formal. Or, to say it in
another way, lambda calculus is a kind of macro processing language like
cpp or m4.

> I don't know if assignment was originally called assignment, or whether
> the association of names with stuff was originally called binding, but
> this terminology is old enough that I've known binding and assignment of
> variables by these names for as long as I can remember, with more or
> less the semantics that Python now uses. "Rebinding" I've not known
> elsewhere.

I think "binding" is too fancy a word to be used with conventional
programming languages like Python. If your programming language has an
assignment statement, "binding" is even nonsensical. Consider:

   def f(x):
       x += 1
       return 2 * x

Now we would have this reduction:

   f(7)
   =>
   7 += 1; return 2 * 7

because "x" would be bound to "7" everywhere in the function body.


Marko

[toc] | [prev] | [next] | [standalone]


#99451

FromChris Angelico <rosuav@gmail.com>
Date2015-11-26 00:50 +1100
Message-ID<mailman.72.1448459462.20593.python-list@python.org>
In reply to#99444
On Wed, Nov 25, 2015 at 11:48 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> I think "binding" is too fancy a word to be used with conventional
> programming languages like Python. If your programming language has an
> assignment statement, "binding" is even nonsensical. Consider:
>
>    def f(x):
>        x += 1
>        return 2 * x
>
> Now we would have this reduction:
>
>    f(7)
>    =>
>    7 += 1; return 2 * 7
>
> because "x" would be bound to "7" everywhere in the function body.

This is exactly the sort of problem that inevitably happens when you
try to extend mathematics into programming. Most branches of
mathematics are simply looking at pure, eternal statements of truth;
if once you discover (or decide) that x is equal to 7, you can
perfectly substitute one for the other in any context. There is no
chronology - x has always been equal to 7, you just didn't know it
until now. It's possible to write code this way, and there are
benefits to it, but as soon as you have an assignment operator, you're
introducing a whole aspect of chronological truth that math lacks, so
some concepts ARE going to need to be modified.

However, that doesn't stop us from making use of terminology, where
it's helpful. We know from grade school that adding two numbers
together and dividing by 2 gives us the average, or the midpoint
between them. Programming languages introduce the notion of adding two
strings together, and also throw the curve-ball at us that sometimes
the average isn't the same as the perfect mathematical average (due to
rounding or other issues). But we'll still call that operation adding,
and we'll still have avg() functions that do what we broadly expect.

ChrisA

[toc] | [prev] | [next] | [standalone]


#99454

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-25 16:08 +0200
Message-ID<87ziy2masl.fsf@elektro.pacujo.net>
In reply to#99451
Chris Angelico <rosuav@gmail.com>:

> On Wed, Nov 25, 2015 at 11:48 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
>> I think "binding" is too fancy a word to be used with conventional
>> programming languages like Python. If your programming language has
>> an assignment statement, "binding" is even nonsensical. Consider:
>>
>>    def f(x):
>>        x += 1
>>        return 2 * x
>>
>> Now we would have this reduction:
>>
>>    f(7)
>>    =>
>>    7 += 1; return 2 * 7
>>
>> because "x" would be bound to "7" everywhere in the function body.
>
> This is exactly the sort of problem that inevitably happens when you
> try to extend mathematics into programming. Most branches of
> mathematics are simply looking at pure, eternal statements of truth;
> if once you discover (or decide) that x is equal to 7, you can
> perfectly substitute one for the other in any context. There is no
> chronology - x has always been equal to 7, you just didn't know it
> until now. It's possible to write code this way, and there are
> benefits to it, but as soon as you have an assignment operator, you're
> introducing a whole aspect of chronological truth that math lacks, so
> some concepts ARE going to need to be modified.
>
> However, that doesn't stop us from making use of terminology, where
> it's helpful.

I think that's the point. Binding is a concept of a formal (textual)
substitution algorithm, which Python's assignment is not.

   Variable-binding mechanisms occur in different contexts in
   mathematics, logic and computer science. In all cases, however, they
   are purely syntactic properties of expressions and variables in them.

   <URL: https://en.wikipedia.org/wiki/Free_variables_and_bound_variable
   s#Formal_explanation>


Marko

[toc] | [prev] | [next] | [standalone]


#99458

FromJussi Piitulainen <harvest@should.be.invalid>
Date2015-11-25 17:13 +0200
Message-ID<lf54mgaxgbh.fsf@ling.helsinki.fi>
In reply to#99444
Marko Rauhamaa writes:

> Jussi Piitulainen writes:
>
>> In point d, McCarthy refers to variables as variables; I'm sure this
>> would go back to Church and 1940's at least, so I expect they used
>> this word already back then. But the ability to store new content to
>> the data structure that associates variables with stuff must be
>> newer.  I think it was new with LISP.
>
> As far as the words "variable" and "binding" go, they are present in
> lambda calculus (1929 and on):

So it's more than ten years earlier than I thought. Old enough, anyway.
Strictly speaking, that a Wikipedia article uses the words "variable"
and "binding" to discuss lambda calculi today is not a proof that Church
used those words in his time. I'm inclined to believe he did. (Our CS
department had a copy of Church's book. It smelled funny.)

A point is that McCarthy knew about lambda calculus. That's where the
name "lambda" for the binding operator comes from, together with
"variable" and "binding" and the correct scoping rules that other people
worked out quite a bit later.

>> I don't know if assignment was originally called assignment, or
>> whether the association of names with stuff was originally called
>> binding, but this terminology is old enough that I've known binding
>> and assignment of variables by these names for as long as I can
>> remember, with more or less the semantics that Python now
>> uses. "Rebinding" I've not known elsewhere.
>
> I think "binding" is too fancy a word to be used with conventional
> programming languages like Python. If your programming language has an
> assignment statement, "binding" is even nonsensical.

The term has more than fifty years of history in languages that have not
only an assignment statement but also mutable things. It's needed to
speak of where and when in a program the occurrences of an identifier
have what meaning. A statement like x = 31 does not affect every x even
in a Python program, only those that are bound in the same namespace.

In Scheme, a variable is bound to a location where its value is stored.
A variable reference evaluates to that stored value. In Python, one
chooses to say that a mumble is bound to an object, but then there is a
namespace that also serves as a store where one can put a new object,
like one can put a new object in a Python dictionary, and then the
mumble becomes bound to that object instead.

These are different ways to talk about the same thing. (The Scheme way
in a sense "explains" mutable store in terms of mathematical functions
where the Python way takes it for granted, I think). No nonsense.

> Consider:
>
>    def f(x):
>        x += 1
>        return 2 * x
>
> Now we would have this reduction:
>
>    f(7)
>    =>
>    7 += 1; return 2 * 7
>
> because "x" would be bound to "7" everywhere in the function body.

You know, people have developed further ways to talk about these things
precisely because substitution semantics is inadequate for what they
wanted to talk about. See references in that Wikipedia article
(Felleisen might be to the point. The field is called denotational
semantics.)

The description, in the language reference (or is it the library
reference), of how Python function calls are evaluated can be seen as an
example. First the actual arguments and possibly some defaults are put
in fresh locations, then the formal parameters are bound to these in an
order that is a bit complicated because of keyword parameters and such,
but nevertheless *bound* *then*. Not substituted to the program text -
who would even think that? And then the evaluation of the occurrences of
the parameters in the code of the function goes through *these* bindings
rather than any other bindings that might be in effect elsewhere in the
program, including any pending calls of the same function.

[toc] | [prev] | [next] | [standalone]


#99464

FromMarko Rauhamaa <marko@pacujo.net>
Date2015-11-25 18:44 +0200
Message-ID<877fl66nb9.fsf@elektro.pacujo.net>
In reply to#99458
Jussi Piitulainen <harvest@should.be.invalid>:

> Marko Rauhamaa writes:
>> As far as the words "variable" and "binding" go, they are present in
>> lambda calculus (1929 and on):
>
> So it's more than ten years earlier than I thought. Old enough,
> anyway. Strictly speaking, that a Wikipedia article uses the words
> "variable" and "binding" to discuss lambda calculi today is not a
> proof that Church used those words in his time. I'm inclined to
> believe he did. (Our CS department had a copy of Church's book. It
> smelled funny.)

I haven't even smelled the originals, but the formalization of variable
substitution was *the* big selling point for lambda calculus.
Previously, combinatory logic solved the age-old problem with variables
by eliminating them altogether:

   Combinatory logic is a notation to eliminate the need for quantified
   variables in mathematical logic.

   <URL: https://en.wikipedia.org/wiki/Combinatory_logic>

>> Now we would have this reduction:
>>
>>    f(7)
>>    =>
>>    7 += 1; return 2 * 7
>>
>> because "x" would be bound to "7" everywhere in the function body.
>
> You know, people have developed further ways to talk about these things
> precisely because substitution semantics is inadequate for what they
> wanted to talk about.

"Assignment" is what everybody uses and understands.

> Not substituted to the program text - who would even think that?

Actually, if Scheme didn't possess set! et al, we would be talking about
true binding. For example, the function

   (define (sum numbers)
     (let loop ((total 0) (remaining numbers))
       (if (null? remaining)
           total
           (loop (+ total (car remaining)) (cdr remaining)))))

can be described and effectively implemented using true, syntactic
binding. To execute such code, you start with an expression, say,
(sum '(1 2 3 4 5)) and keep on rewriting the expression until you can't
rewrite it anymore.

The availability of set! forces the implementation to generate a memory
slot for each binding, turning the binding semantics into an assignment
semantics.


Marko

[toc] | [prev] | [next] | [standalone]


#99473

FromJussi Piitulainen <harvest@should.be.invalid>
Date2015-11-25 20:30 +0200
Message-ID<lf5wpt6vsnk.fsf@ling.helsinki.fi>
In reply to#99464
Marko Rauhamaa writes:
> Jussi Piitulainen writes:
>
>> You know, people have developed further ways to talk about these
>> things precisely because substitution semantics is inadequate for
>> what they wanted to talk about.
>
> "Assignment" is what everybody uses and understands.

You can tell that to those who insist otherwise, and to those who
understand it differently, and to those who are just confused.
All are around in this thread.

But yes, I would find it easier if variables could be called variables,
assignment could be called assignment, and binding could be called
binding even in Python (variations of the last one somewhat work; the
former two are problematic in the way that any mention of regular
expressions is, whether you've noticed it or not).

>> Not substituted to the program text - who would even think that?
>
> Actually, if Scheme didn't possess set! et al, we would be talking
> about true binding. For example, the function
>
>    (define (sum numbers)
>      (let loop ((total 0) (remaining numbers))
>        (if (null? remaining)
>            total
>            (loop (+ total (car remaining)) (cdr remaining)))))
>
> can be described and effectively implemented using true, syntactic
> binding. To execute such code, you start with an expression, say,
> (sum '(1 2 3 4 5)) and keep on rewriting the expression until you can't
> rewrite it anymore.

Interesting. Can you just keep reducing / expanding the expression
without reference to an environment? I see how it's easy to talk about
assignment because one can talk about something else, but I'm not yet
quite sure how you intend to handle recursion.

==> (let loop ((total 0) (remaining '(1 2 3 4 5)))
       (if (null? remaining)
           total
           (loop (+ total (car remaining)) (cdr remaining))))

Now what? Rewrite using a call-by-value fixed-point operator and keep
insisting that you just saw a squirrel? Or rewrite with respect to an
environment where loop is bound to a lambda expression that is closed in
that same environment and this is somehow true substitution and you just
saw a squirrel? Link to a Wikipedia page that tells what call-by-value
and call-by-reference are and remind me that one should really talk
about passing a reference by value?

That last one is as irrelevant as squirrels, by the way.

> The availability of set! forces the implementation to generate a
> memory slot for each binding, turning the binding semantics into an
> assignment semantics.

Thank you.

I'm probably out now.

[toc] | [prev] | [next] | [standalone]


#99361

FromSteven D'Aprano <steve@pearwood.info>
Date2015-11-25 03:11 +1100
Message-ID<56548c31$0$1596$c3e8da3$5496439d@news.astraweb.com>
In reply to#99325
On Tue, 24 Nov 2015 11:57 pm, 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?

No it isn't.

The definition of "object" -- well, I say "the" definition, but the nasty
truth is that there are many different definitions and nobody really agrees
on what an object is -- the definition of "object" is a software entity
with three fundamental attributes or qualities:

- the type of object;

- the value of the object;

- the identity of the object.

If we limit ourselves to Python, that definition works because Python has
been designed to work that way. Other languages may be different, but when
it comes to Python, it is true by definition that all objects have a type,
a value and an identity because that's what Guido did.

The type of the object is the class that it is an instance of:

py> type("hello")
<class 'str'>

The identity of the object is represented by the integer ID returned by the
id() function. But what it represents is the distinct existence of one
object as compared to another. In real life, the identity of *this* sheep
versus *that* sheep, or this instance of a book versus that instance of the
same book.

(Aside: those of a philosophical bent will quickly realise that we don't
really understand what identity *is*. See, for example, the paradox of my
gradfather's axe. And what distinguishes this electron from some other
electron? There's even a theory in physics that *all electrons are in fact
the one electron*, bouncing backwards and forwards in time repeatedly.)

The value of the object depends on its type -- the value of ints differ from
the value of strings, for example.

Immutable objects have a fixed value for their entire lifespan: the object 2
has the same numeric value, namely two, from the moment it is instantiated
to the moment it is garbage collected.

Mutable objects do not have such a fixed value:

py> L = []  # value is the empty list
py> L.append(None)  # value is now a singleton list containing None
py> L[:] = 'cat dog fox'.split()  # value is now a list containing strings
cat, dog, fox.
py> L
['cat', 'dog', 'fox']


It's the same list, the same object, but the value changes.




-- 
Steven

[toc] | [prev] | [standalone]


Page 10 of 10 — ← Prev page 1 … 8 9 [10]

Back to top | Article view | comp.lang.python


csiph-web