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 4 of 10 — ← Prev page 1 2 3 [4] 5 6 … 10 Next page →
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-25 02:17 +1100 |
| Message-ID | <mailman.5.1448378237.20593.python-list@python.org> |
| In reply to | #99111 |
On Wed, Nov 25, 2015 at 2:03 AM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> Op 24-11-15 om 15:34 schreef Chris Angelico:
>> On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon
>> <antoon.pardon@rece.vub.ac.be> wrote:
>>>> Start thinking of it as a constructor call rather than a literal, and
>>>> you'll get past most of the confusion.
>>>
>>> That doesn't change the fact it does look like a literal and not like
>>> a constructor.
>>
>> Then explain how this is a literal:
>>
>> squares = [x*x for x in range(int(input("How far? ")))]
>
> So are you saying
>
> () isn't a literal
>
> because
>
> (x * x for x in range(int(input("How far? ")))) isn't a literal?
I'm pretty sure tuple/list/dict display predates comprehensions, and
was already not a literal syntax. Steven, you know the history better
than I do - confirm or deny?
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-25 04:54 +1100 |
| Message-ID | <5654a43d$0$1622$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99354 |
On Wed, 25 Nov 2015 02:17 am, Chris Angelico wrote:
> On Wed, Nov 25, 2015 at 2:03 AM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> So are you saying
>>
>> () isn't a literal
>>
>> because
>>
>> (x * x for x in range(int(input("How far? ")))) isn't a literal?
>
> I'm pretty sure tuple/list/dict display predates comprehensions, and
> was already not a literal syntax. Steven, you know the history better
> than I do - confirm or deny?
I must admit that I'm often guilty of referring to [a, b, c] as a list
literal, but, no, () and related forms aren't literals[1], and yes,
tuple/list/dict displays predates list comprehensions by a long time.
Here's Python 1.5:
Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC 4.1.2 20080704 (Red Hat
4.1.2-52)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import dis
>>> code = compile("(1, 2, 3)", "", "eval")
>>> dis.dis(code)
0 SET_LINENO 0
3 LOAD_CONST 0 (1)
6 LOAD_CONST 1 (2)
9 LOAD_CONST 2 (3)
12 BUILD_TUPLE 3
15 RETURN_VALUE
So you can see the tuple actually gets assembled at runtime. Even if the
tuple is empty, the same process occurs:
>>> code = compile("()", "", "eval")
>>> dis.dis(code)
0 SET_LINENO 0
3 BUILD_TUPLE 0
6 RETURN_VALUE
In contrast, using an actual literal (even a big one) loads the literal as a
pre-existing constant:
>>> code = compile("42000009999999999L", "", "eval")
>>> dis.dis(code)
0 SET_LINENO 0
3 LOAD_CONST 0 (42000009999999999L)
6 RETURN_VALUE
[1] Although with recent versions of Python, the peephole optimizer is
clever enough to treat tuples consisting of nothing but literals as if it
were itself a literal. E.g. in Python 3.3:
py> import dis
py> code = compile("(1, 2, 3)", "", "eval")
py> dis.dis(code)
1 0 LOAD_CONST 3 ((1, 2, 3))
3 RETURN_VALUE
But that is a recent optimization, and it relies on the facts that tuples
are immutable, and that the items within the tuple are themselves immutable
literals:
py> code = compile("(1, 2, [])", "", "eval")
py> dis.dis(code)
1 0 LOAD_CONST 0 (1)
3 LOAD_CONST 1 (2)
6 BUILD_LIST 0
9 BUILD_TUPLE 3
12 RETURN_VALUE
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 16:46 +0100 |
| Message-ID | <mailman.8.1448379989.20593.python-list@python.org> |
| In reply to | #99111 |
Op 24-11-15 om 16:17 schreef Chris Angelico:
> On Wed, Nov 25, 2015 at 2:03 AM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> Op 24-11-15 om 15:34 schreef Chris Angelico:
>>> On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon
>>> <antoon.pardon@rece.vub.ac.be> wrote:
>>>>> Start thinking of it as a constructor call rather than a literal, and
>>>>> you'll get past most of the confusion.
>>>>
>>>> That doesn't change the fact it does look like a literal and not like
>>>> a constructor.
>>>
>>> Then explain how this is a literal:
>>>
>>> squares = [x*x for x in range(int(input("How far? ")))]
>>
>> So are you saying
>>
>> () isn't a literal
>>
>> because
>>
>> (x * x for x in range(int(input("How far? ")))) isn't a literal?
>
> I'm pretty sure tuple/list/dict display predates comprehensions, and
> was already not a literal syntax. Steven, you know the history better
> than I do - confirm or deny?
What is your point? I say that [] looks like a literal. Because it
sure resembles () which is a literal.
That [] in fact isn't a literal doesn't contradict it looks like
one.
That you can come up with more complicated list expressions that
are more easily recognizable as not being literals is beside the
point because we have generator expressions that look similar to
those list comprehensions and those generator expressions don't
contradict that () is a literal.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-25 02:48 +1100 |
| Message-ID | <mailman.10.1448380115.20593.python-list@python.org> |
| In reply to | #99111 |
On Wed, Nov 25, 2015 at 2:46 AM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > What is your point? I say that [] looks like a literal. Because it > sure resembles () which is a literal. > > That [] in fact isn't a literal doesn't contradict it looks like > one. > > That you can come up with more complicated list expressions that > are more easily recognizable as not being literals is beside the > point because we have generator expressions that look similar to > those list comprehensions and those generator expressions don't > contradict that () is a literal. () is not a literal either. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Random832 <random832@fastmail.com> |
|---|---|
| Date | 2015-11-24 16:28 +0000 |
| Message-ID | <mailman.12.1448382559.20593.python-list@python.org> |
| In reply to | #99111 |
On 2015-11-24, Chris Angelico <rosuav@gmail.com> wrote: > On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon ><antoon.pardon@rece.vub.ac.be> wrote: >>> Start thinking of it as a constructor call rather than a literal, and >>> you'll get past most of the confusion. >> >> That doesn't change the fact it does look like a literal and not like >> a constructor. > > Neither of them is a literal, even though one of them isn't even > constructing a list. Tuples may be constant, but they still don't have > a literal form. How do you define "literal form"? I define it as any syntax that can participate in ast.literal_eval (And I consider [...] to be a literal form regardless of whether the ... values are literals or not). I don't think "Start thinking of it as a constructor call rather than a literal" is helpful, since it just hides one's confusion about what a literal is. The Python documentation itself seems to assume that "literal" should only be used for things that are a single token, though I have no idea where this thinking comes from.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-25 03:38 +1100 |
| Message-ID | <mailman.13.1448383094.20593.python-list@python.org> |
| In reply to | #99111 |
On Wed, Nov 25, 2015 at 3:28 AM, Random832 <random832@fastmail.com> wrote:
> On 2015-11-24, Chris Angelico <rosuav@gmail.com> wrote:
>> On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon
>><antoon.pardon@rece.vub.ac.be> wrote:
>>>> Start thinking of it as a constructor call rather than a literal, and
>>>> you'll get past most of the confusion.
>>>
>>> That doesn't change the fact it does look like a literal and not like
>>> a constructor.
>>
>> Neither of them is a literal, even though one of them isn't even
>> constructing a list. Tuples may be constant, but they still don't have
>> a literal form.
>
> How do you define "literal form"? I define it as any syntax that
> can participate in ast.literal_eval (And I consider [...] to be a
> literal form regardless of whether the ... values are literals or
> not). I don't think "Start thinking of it as a constructor call
> rather than a literal" is helpful, since it just hides one's
> confusion about what a literal is.
https://docs.python.org/3/reference/lexical_analysis.html#literals
ast.literal_eval can handle a number of things which are not literals,
as long as they use nothing but literals combined by a restricted set
of operators. For instance, Python has no complex literals, only
imaginary ones - but:
>>> ast.literal_eval("1+2j")
(1+2j)
And Python certainly doesn't have "expression literals", yet:
>>> ast.literal_eval("[1,1+1,3]")
[1, 2, 3]
Its support for list display equally doesn't make that into a literal.
> The Python documentation itself seems to assume that "literal"
> should only be used for things that are a single token, though I
> have no idea where this thinking comes from.
Probably the grammar. In other words, it's part of the language's very
definition.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 17:41 +0100 |
| Message-ID | <mailman.15.1448383274.20593.python-list@python.org> |
| In reply to | #99111 |
Op 24-11-15 om 16:48 schreef Chris Angelico:
> On Wed, Nov 25, 2015 at 2:46 AM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> What is your point? I say that [] looks like a literal. Because it
>> sure resembles () which is a literal.
>>
>> That [] in fact isn't a literal doesn't contradict it looks like
>> one.
>>
>> That you can come up with more complicated list expressions that
>> are more easily recognizable as not being literals is beside the
>> point because we have generator expressions that look similar to
>> those list comprehensions and those generator expressions don't
>> contradict that () is a literal.
>
> () is not a literal either.
The byte code sure suggests it is.
Take the following code:
import dis
def f():
i = 42
t = ()
l = []
dis.dis(f)
That produces the following:
4 0 LOAD_CONST 1 (42)
3 STORE_FAST 0 (i)
5 6 LOAD_CONST 2 (())
9 STORE_FAST 1 (t)
6 12 BUILD_LIST 0
15 STORE_FAST 2 (l)
18 LOAD_CONST 0 (None)
21 RETURN_VALUE
So on what grounds would you argue that () is not a literal.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-24 09:56 -0700 |
| Message-ID | <mailman.17.1448384205.20593.python-list@python.org> |
| In reply to | #99111 |
On Tue, Nov 24, 2015 at 9:41 AM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > Op 24-11-15 om 16:48 schreef Chris Angelico: >> () is not a literal either. > > The byte code sure suggests it is. > > Take the following code: > > import dis > > def f(): > i = 42 > t = () > l = [] > > dis.dis(f) > > That produces the following: > > > 4 0 LOAD_CONST 1 (42) > 3 STORE_FAST 0 (i) > > 5 6 LOAD_CONST 2 (()) > 9 STORE_FAST 1 (t) > > 6 12 BUILD_LIST 0 > 15 STORE_FAST 2 (l) > 18 LOAD_CONST 0 (None) > 21 RETURN_VALUE I'm not sure what this is meant to prove. None is clearly an identifier, not a literal, and it also gets treated as a constant in the code above. > So on what grounds would you argue that () is not a literal. This enumerates exactly what literals are in Python: https://docs.python.org/3/reference/lexical_analysis.html#literals I think it's a rather pedantic point, though. How are nuances of the grammar at all related to user expectations?
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 18:32 +0100 |
| Message-ID | <mailman.19.1448386330.20593.python-list@python.org> |
| In reply to | #99111 |
Op 24-11-15 om 17:56 schreef Ian Kelly: > >> So on what grounds would you argue that () is not a literal. > > This enumerates exactly what literals are in Python: > > https://docs.python.org/3/reference/lexical_analysis.html#literals > > I think it's a rather pedantic point, though. How are nuances of the > grammar at all related to user expectations? > I think that enumaration is too limited. The section starts with: Literals are notations for constant values of some built-in types. () satisfies that definition, which is confirmed by the byte code produced for it. -- Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-24 10:53 -0700 |
| Message-ID | <mailman.21.1448387666.20593.python-list@python.org> |
| In reply to | #99111 |
On Tue, Nov 24, 2015 at 10:32 AM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> Op 24-11-15 om 17:56 schreef Ian Kelly:
>
>>
>>> So on what grounds would you argue that () is not a literal.
>>
>> This enumerates exactly what literals are in Python:
>>
>> https://docs.python.org/3/reference/lexical_analysis.html#literals
>>
>> I think it's a rather pedantic point, though. How are nuances of the
>> grammar at all related to user expectations?
>>
>
> I think that enumaration is too limited. The section starts with:
>
> Literals are notations for constant values of some built-in types.
>
> () satisfies that definition, which is confirmed by the byte code
> produced for it.
Literals are a type of lexical token. All of the literals shown in
that section are, indeed, tokens. Now I would point you to the grammar
specification:
https://docs.python.org/3/reference/grammar.html
And specifically the "atom" rule, which defines both list displays and
list comprehensions (as well as literals) as being atoms.
Specifically, it parses () as the token '(', followed by an optional
yield_expr or testlist_comp, followed by the token ')'. In no way is
that a single token, nor therefore a literal.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-24 11:04 -0700 |
| Message-ID | <mailman.22.1448388286.20593.python-list@python.org> |
| In reply to | #99111 |
On Tue, Nov 24, 2015 at 10:53 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Tue, Nov 24, 2015 at 10:32 AM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> Op 24-11-15 om 17:56 schreef Ian Kelly:
>>
>>>
>>>> So on what grounds would you argue that () is not a literal.
>>>
>>> This enumerates exactly what literals are in Python:
>>>
>>> https://docs.python.org/3/reference/lexical_analysis.html#literals
>>>
>>> I think it's a rather pedantic point, though. How are nuances of the
>>> grammar at all related to user expectations?
>>>
>>
>> I think that enumaration is too limited. The section starts with:
>>
>> Literals are notations for constant values of some built-in types.
>>
>> () satisfies that definition, which is confirmed by the byte code
>> produced for it.
>
> Literals are a type of lexical token. All of the literals shown in
> that section are, indeed, tokens. Now I would point you to the grammar
> specification:
>
> https://docs.python.org/3/reference/grammar.html
>
> And specifically the "atom" rule, which defines both list displays and
> list comprehensions (as well as literals) as being atoms.
> Specifically, it parses () as the token '(', followed by an optional
> yield_expr or testlist_comp, followed by the token ')'. In no way is
> that a single token, nor therefore a literal.
In case reading the grammar doesn't convince, we can also get this
result from playing with the language:
>>> import tokenize
>>> from io import StringIO
>>> list(tokenize.generate_tokens(StringIO('()').readline))
[TokenInfo(type=52 (OP), string='(', start=(1, 0), end=(1, 1),
line='()'), TokenInfo(type=52 (OP), string=')', start=(1, 1), end=(1,
2), line='()'), TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0),
end=(2, 0), line='')]
Two separate tokens of the OP type.
>>> list(tokenize.generate_tokens(StringIO('42').readline))
[TokenInfo(type=2 (NUMBER), string='42', start=(1, 0), end=(1, 2),
line='42'), TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0),
end=(2, 0), line='')]
One token, of a literal type.
>>> list(tokenize.generate_tokens(StringIO('(1,2,3)').readline))
[TokenInfo(type=52 (OP), string='(', start=(1, 0), end=(1, 1),
line='(1,2,3)'), TokenInfo(type=2 (NUMBER), string='1', start=(1, 1),
end=(1, 2), line='(1,2,3)'), TokenInfo(type=52 (OP), string=',',
start=(1, 2), end=(1, 3), line='(1,2,3)'), TokenInfo(type=2 (NUMBER),
string='2', start=(1, 3), end=(1, 4), line='(1,2,3)'),
TokenInfo(type=52 (OP), string=',', start=(1, 4), end=(1, 5),
line='(1,2,3)'), TokenInfo(type=2 (NUMBER), string='3', start=(1, 5),
end=(1, 6), line='(1,2,3)'), TokenInfo(type=52 (OP), string=')',
start=(1, 6), end=(1, 7), line='(1,2,3)'), TokenInfo(type=0
(ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')]
Two tokens for the parentheses, plus three literal tokens for the
ints, plus two more tokens for the separating commas. Definitely not a
literal.
Credit to Steven for using this approach to make a similar point about
literals in a previous thread.
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 19:45 +0100 |
| Message-ID | <mailman.26.1448390717.20593.python-list@python.org> |
| In reply to | #99111 |
Op 24-11-15 om 18:53 schreef Ian Kelly:
> On Tue, Nov 24, 2015 at 10:32 AM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> Op 24-11-15 om 17:56 schreef Ian Kelly:
>>
>>>
>>>> So on what grounds would you argue that () is not a literal.
>>>
>>> This enumerates exactly what literals are in Python:
>>>
>>> https://docs.python.org/3/reference/lexical_analysis.html#literals
>>>
>>> I think it's a rather pedantic point, though. How are nuances of the
>>> grammar at all related to user expectations?
>>>
>>
>> I think that enumaration is too limited. The section starts with:
>>
>> Literals are notations for constant values of some built-in types.
>>
>> () satisfies that definition, which is confirmed by the byte code
>> produced for it.
>
> Literals are a type of lexical token. All of the literals shown in
> that section are, indeed, tokens. Now I would point you to the grammar
> specification:
>
> https://docs.python.org/3/reference/grammar.html
>
> And specifically the "atom" rule, which defines both list displays and
> list comprehensions (as well as literals) as being atoms.
> Specifically, it parses () as the token '(', followed by an optional
> yield_expr or testlist_comp, followed by the token ')'. In no way is
> that a single token, nor therefore a literal.
I think limiting literals to lexical tokens is too limited. Sure we
can define them like that in the context of the python grammar, but
I don't see why we should limit ourselves to such a definition outside
that context.
I see nothing wrong with regarding -42 as a literal while according
to the python grammar it isn't.
There is nothing wrong with the notion that a literal can be a
compounded value.
But no matter what you want to call it. The dis module shows that
-42 is treated in exactly the same way as 42, which is treated
exactly the same way as () or as (5, 8, 13) which is treated
differently from [] or [5, 8, 13].
Whether you want to call it literals or something else, the fact
remains that (3, 5, 8) is treated like -42 by the CPython interpreter
and [3, 5, 8] is not.
--
Antoon.
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2015-11-24 10:54 -0800 |
| Message-ID | <36243614-aaaf-40df-a6b7-5b669cec02e1@googlegroups.com> |
| In reply to | #99385 |
On Tuesday, November 24, 2015 at 1:45:34 PM UTC-5, Antoon Pardon wrote: > Whether you want to call it literals or something else, the fact > remains that (3, 5, 8) is treated like -42 by the CPython interpreter > and [3, 5, 8] is not. Maybe I've lost the original point in all this minutia about what is a literal and what is not. Isn't the key point here that some objects are mutable (lists), and some are not (tuples, ints)? --Ned.
[toc] | [prev] | [next] | [standalone]
| From | Random832 <random832@fastmail.com> |
|---|---|
| Date | 2015-11-24 19:00 +0000 |
| Message-ID | <mailman.27.1448391661.20593.python-list@python.org> |
| In reply to | #99111 |
On 2015-11-24, Chris Angelico <rosuav@gmail.com> wrote:
> Probably the grammar. In other words, it's part of the language's very
> definition.
Then the definition is wrong. I think "literal" is a word whose meaning is
generally agreed on, rather than something each language's spec can invent from
whole cloth for itself. It's not a python term, it's a programming term.
And the documentation doesn't even use it consistently; it calls {} a literal.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2015-11-25 11:34 +1100 |
| Message-ID | <56550227$0$1585$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #99387 |
On Wed, 25 Nov 2015 06:00 am, Random832 wrote:
> On 2015-11-24, Chris Angelico <rosuav@gmail.com> wrote:
>> Probably the grammar. In other words, it's part of the language's very
>> definition.
>
> Then the definition is wrong. I think "literal" is a word whose meaning is
> generally agreed on, rather than something each language's spec can invent
> from whole cloth for itself. It's not a python term, it's a programming
> term.
Well, I don't know about that. According to you, and Ruby, this is a
literal:
[x+1, y+2*x, func(arg), MyClass(a, b)]
http://ruby-doc.org/core-2.1.1/doc/syntax/literals_rdoc.html#label-Arrays
which seems like an abuse of the term to me. How can it be a *literal* when
it contains non-literal expressions which aren't known until runtime?
Although I note that the actual examples of Array literals and Hash literals
in the Ruby docs punt on the issue by only showing expressions that could
be replaced by constants by a peephole optimizer.
Lua refers to *string literals* but *table constructors*:
http://www.lua.org/manual/5.1/manual.html
Apart from strings, the above manual avoids the use of "literal".
> And the documentation doesn't even use it consistently; it calls {} a
> literal.
Citation required.
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-24 12:15 -0700 |
| Message-ID | <mailman.28.1448392545.20593.python-list@python.org> |
| In reply to | #99111 |
On Tue, Nov 24, 2015 at 11:45 AM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > I think limiting literals to lexical tokens is too limited. Sure we > can define them like that in the context of the python grammar, but > I don't see why we should limit ourselves to such a definition outside > that context. > > I see nothing wrong with regarding -42 as a literal while according > to the python grammar it isn't. > > There is nothing wrong with the notion that a literal can be a > compounded value. I'm somewhat inclined to agree with this. Taking an example from another language, if you use Javascript you'll hear all the time about "object literals" or "object literal notation". If you read the ECMAScript spec, however, you won't find the phrase "object literal" in there once. It seems that the common usage of "literal" is not the same as the way it's used in formal writing of language specifications. > But no matter what you want to call it. The dis module shows that > -42 is treated in exactly the same way as 42, which is treated > exactly the same way as () or as (5, 8, 13) which is treated > differently from [] or [5, 8, 13]. This is an implementation detail. The compiler would also be free to compile -42 into byte code as the negation of the constant 42. That 42 is a literal, on the other hand, is part of the language specification.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-24 12:15 -0700 |
| Message-ID | <mailman.29.1448392590.20593.python-list@python.org> |
| In reply to | #99111 |
On Tue, Nov 24, 2015 at 12:00 PM, Random832 <random832@fastmail.com> wrote: > On 2015-11-24, Chris Angelico <rosuav@gmail.com> wrote: >> Probably the grammar. In other words, it's part of the language's very >> definition. > > Then the definition is wrong. I think "literal" is a word whose meaning is > generally agreed on, rather than something each language's spec can invent from > whole cloth for itself. It's not a python term, it's a programming term. The Python language spec uses the word the same way that other language specs do. Is it the spec's usage that is wrong, or the common understanding of it?
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 21:54 +0100 |
| Message-ID | <mailman.33.1448398558.20593.python-list@python.org> |
| In reply to | #99111 |
Op 24-11-15 om 20:15 schreef Ian Kelly: >> But no matter what you want to call it. The dis module shows that >> -42 is treated in exactly the same way as 42, which is treated >> exactly the same way as () or as (5, 8, 13) which is treated >> differently from [] or [5, 8, 13]. > > This is an implementation detail. The compiler would also be free to > compile -42 into byte code as the negation of the constant 42. That 42 > is a literal, on the other hand, is part of the language > specification. I think you are picking nits. Sure the byte code could compile -42 into a byte code for 42 and a negation. Just as it could compile 42 into byte code for adding 32, 8 and 2. The point is, that the reverse isn't true. It couldn't compile [5, 8, 13] into a LOAD_CONST. -- Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-24 21:14 +0000 |
| Message-ID | <n32jqq$k4j$1@dont-email.me> |
| In reply to | #99394 |
On 24/11/2015 20:54, Antoon Pardon wrote:
> Op 24-11-15 om 20:15 schreef Ian Kelly:
>
>>> But no matter what you want to call it. The dis module shows that
>>> -42 is treated in exactly the same way as 42, which is treated
>>> exactly the same way as () or as (5, 8, 13) which is treated
>>> differently from [] or [5, 8, 13].
>>
>> This is an implementation detail. The compiler would also be free to
>> compile -42 into byte code as the negation of the constant 42. That 42
>> is a literal, on the other hand, is part of the language
>> specification.
>
> I think you are picking nits. Sure the byte code could compile -42 into
> a byte code for 42 and a negation. Just as it could compile 42 into byte
> code for adding 32, 8 and 2.
>
> The point is, that the reverse isn't true. It couldn't compile [5, 8, 13]
> into a LOAD_CONST.
I think it can, with a couple of extra instructions:
LOAD_GLOBAL 0 (list)
LOAD_CONST 1 ((5, 8, 13))
CALL_FUNCTION
ie. by converting a tuple to a list, but it can also be done with a
special byte-code. The effect is a that a constant list can be
constructed without having to evalate each element at runtime, which I
assume would be less efficient if the list is big enough (perhaps not
for just 3 elements).
--
Bartc
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2015-11-24 22:25 +0100 |
| Message-ID | <mailman.35.1448400323.20593.python-list@python.org> |
| In reply to | #99396 |
Op 24-11-15 om 22:14 schreef BartC: > On 24/11/2015 20:54, Antoon Pardon wrote: >> Op 24-11-15 om 20:15 schreef Ian Kelly: >> >>>> But no matter what you want to call it. The dis module shows that >>>> -42 is treated in exactly the same way as 42, which is treated >>>> exactly the same way as () or as (5, 8, 13) which is treated >>>> differently from [] or [5, 8, 13]. >>> >>> This is an implementation detail. The compiler would also be free to >>> compile -42 into byte code as the negation of the constant 42. That 42 >>> is a literal, on the other hand, is part of the language >>> specification. >> >> I think you are picking nits. Sure the byte code could compile -42 into >> a byte code for 42 and a negation. Just as it could compile 42 into byte >> code for adding 32, 8 and 2. >> >> The point is, that the reverse isn't true. It couldn't compile [5, 8, 13] >> into a LOAD_CONST. > > I think it can, with a couple of extra instructions: Sure it can with a couple of extra instructions. With extra instructions you can always use constants to build a mutable. The point is that a tuple can just be loaded as a constant without needing something extra. -- Antoon.
[toc] | [prev] | [next] | [standalone]
Page 4 of 10 — ← Prev page 1 2 3 [4] 5 6 … 10 Next page →
Back to top | Article view | comp.lang.python
csiph-web