Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66792 > unrolled thread
| Started by | Sam <lightaiyee@gmail.com> |
|---|---|
| First post | 2014-02-20 22:37 -0800 |
| Last post | 2014-03-01 15:22 +1100 |
| Articles | 20 on this page of 219 — 28 participants |
Back to article view | Back to comp.lang.python
Can global variable be passed into Python function? Sam <lightaiyee@gmail.com> - 2014-02-20 22:37 -0800
Re: Can global variable be passed into Python function? dieter <dieter@handshake.de> - 2014-02-21 08:23 +0100
Re: Can global variable be passed into Python function? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-02-21 10:55 +0200
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-21 12:10 +0200
Re: Can global variable be passed into Python function? Peter Otten <__peter__@web.de> - 2014-02-21 08:34 +0100
Re: Can global variable be passed into Python function? Gary Herron <gary.herron@islandtraining.com> - 2014-02-21 00:41 -0800
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-21 08:55 +0000
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-21 07:13 -0500
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-21 14:52 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 03:28 +0000
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-21 22:45 -0500
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 06:29 +0000
Re: Can global variable be passed into Python function? Travis Griggs <travisgriggs@gmail.com> - 2014-02-21 09:59 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 05:16 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-21 21:20 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 17:36 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 07:18 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 18:29 +1100
Re: Can global variable be passed into Python function? wxjmfauth@gmail.com - 2014-02-22 00:02 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 19:10 +1100
Re: Can global variable be passed into Python function? wxjmfauth@gmail.com - 2014-02-22 00:26 -0800
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 08:28 +0000
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 08:35 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 19:45 +1100
Re: Can global variable be passed into Python function? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-24 21:07 +1300
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 15:57 +0000
Re: Can global variable be passed into Python function? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-24 21:12 -0500
Re: Can global variable be passed into Python function? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-26 23:59 +1300
Re: Can global variable be passed into Python function? MRAB <python@mrabarnett.plus.com> - 2014-02-26 18:59 +0000
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 06:57 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-22 09:28 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-22 08:45 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-22 19:54 +1100
Python and variables (was: Can global variable be passed into Python function?) Ben Finney <ben+python@benfinney.id.au> - 2014-02-22 11:13 +1100
Re: Can global variable be passed into Python function? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-21 21:47 -0500
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-21 22:14 -0500
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-22 14:15 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-22 16:44 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 01:39 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-23 12:50 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 06:20 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-23 18:23 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-23 11:52 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 10:30 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-23 21:32 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-23 13:01 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-23 22:12 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-23 17:24 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-24 02:41 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-23 23:04 +0200
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-23 21:18 +0000
Re: Can global variable be passed into Python function? Terry Reedy <tjreedy@udel.edu> - 2014-02-23 12:06 -0500
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-23 23:10 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 00:37 +0000
Re: Can global variable be passed into Python function? wxjmfauth@gmail.com - 2014-02-24 01:35 -0800
Re: Can global variable be passed into Python function? j.e.haque@gmail.com - 2014-02-24 10:05 -0800
Re: [OT] Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-02-24 11:19 -0700
Re: [OT] Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-02-24 19:42 +0000
Re: [OT] Can global variable be passed into Python function? Dave Angel <davea@davea.name> - 2014-03-01 23:02 -0500
Re: [OT] Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-03-02 16:45 +0000
Re: [OT] Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 16:55 +0000
Re: [OT] Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-03 06:24 +1100
Re: [OT] Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-03-03 14:18 +0000
Re: [OT] Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-04 01:25 +1100
Re: [OT] Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 15:17 +1100
Re: [OT] Can global variable be passed into Python function? Dave Angel <davea@davea.name> - 2014-03-02 08:22 -0500
Re: [OT] Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-03 00:57 +1100
Re: [OT] Can global variable be passed into Python function? Dave Angel <davea@davea.name> - 2014-03-02 14:17 -0500
Re: [OT] Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-03 06:32 +1100
Re: [OT] Can global variable be passed into Python function? Dave Angel <davea@davea.name> - 2014-03-02 17:58 -0500
Re: Can global variable be passed into Python function? random832@fastmail.us - 2014-02-24 13:20 -0500
Re: [OT] Can global variable be passed into Python function? random832@fastmail.us - 2014-02-24 13:21 -0500
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-25 05:22 +1100
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-25 05:25 +1100
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-24 20:00 +0000
Re: Can global variable be passed into Python function? Dave Angel <davea@davea.name> - 2014-02-22 10:02 -0500
Re: Can global variable be passed into Python function? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-22 13:03 -0500
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-23 00:39 +0000
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-02-22 19:57 -0500
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 05:24 -0800
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-27 12:54 -0500
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 15:29 -0800
Re: Can global variable be passed into Python function? Steven D'Aprano <steve@pearwood.info> - 2014-02-28 02:07 +0000
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 18:29 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 15:43 +1100
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 21:39 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 16:53 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 09:43 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve@pearwood.info> - 2014-02-28 08:23 +0000
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-02-28 19:46 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 12:02 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 21:55 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 13:30 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 22:51 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 14:25 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 00:22 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 22:08 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 13:38 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 23:22 +1100
Re: Can global variable be passed into Python function? Neil Cerutti <neilc@norwich.edu> - 2014-02-28 13:47 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 16:26 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 01:37 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 17:29 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 02:46 +1100
Re: Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-02-28 16:09 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 10:00 +0200
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-02-28 09:43 -0500
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 10:00 +0200
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 17:26 +0200
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-03-02 10:34 -0500
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 17:52 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-03 03:23 +1100
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 16:53 +0000
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-28 15:06 +0000
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-28 15:50 +0000
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 10:04 -0800
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 20:53 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 05:59 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 21:20 +0200
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 12:22 -0800
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-02-28 23:03 +0200
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-28 21:23 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 01:06 +0200
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 11:02 +1100
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-02-28 19:48 -0500
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 13:00 +1100
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-02-28 22:15 -0500
Re: Can global variable be passed into Python function? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-10 14:12 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-10 16:29 +0200
Re: Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-02-28 22:00 +0000
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-02 09:36 +1100
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-03-01 14:50 -0800
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 15:36 -0800
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 02:32 +0200
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-28 19:40 -0500
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 17:08 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 13:01 +1100
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 21:30 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 17:24 +1100
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-03-01 13:40 -0800
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 22:01 +0000
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-03-01 14:07 -0800
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 23:21 +0000
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-03-01 16:23 -0800
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 11:28 +1100
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 00:36 +0000
Re: Can global variable be passed into Python function? Ned Deily <nad@acm.org> - 2014-03-01 16:55 -0800
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 01:15 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 09:11 +1100
Re: Can global variable be passed into Python function? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-28 21:15 -0500
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 20:36 -0800
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 01:07 +0000
Re: Can global variable be passed into Python function? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-01 16:10 +1300
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-02-28 19:02 -0500
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-28 23:33 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 12:50 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-28 23:04 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 02:03 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 00:44 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 03:06 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 01:59 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 13:03 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 03:29 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 12:39 +0200
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 01:10 +0000
Re: Can global variable be passed into Python function? "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 17:29 -0800
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 10:17 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 02:11 +0200
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 11:50 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 03:10 +0200
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 01:19 +0000
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 12:41 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 12:31 +0200
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 21:48 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 13:28 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-01 22:59 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 17:07 +0000
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 04:27 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 20:25 +0200
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-02 09:30 +1100
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 23:13 +0000
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-02 00:03 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 19:23 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 04:30 +1100
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-02 09:34 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 10:03 +0200
Re: Can global variable be passed into Python function? Ben Finney <ben+python@benfinney.id.au> - 2014-03-02 21:59 +1100
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 13:00 +0000
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-01 15:15 +0000
Re: Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-03-01 10:05 -0700
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-01 19:29 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 04:36 +1100
Re: Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-03-01 11:06 -0700
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-03-01 13:30 -0500
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-02 08:35 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 11:35 +0200
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 11:40 +0200
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-02 21:07 +1100
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 12:37 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-02 10:44 +0000
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 13:33 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-03 01:50 +0000
Re: Can global variable be passed into Python function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-02 13:04 +0000
Re: Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-03-02 11:48 -0700
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-02 23:03 +0200
Re: Can global variable be passed into Python function? Roy Smith <roy@panix.com> - 2014-03-02 16:16 -0500
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-03-03 08:28 +1100
Re: Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-03-02 14:44 -0700
Re: Can global variable be passed into Python function? Marko Rauhamaa <marko@pacujo.net> - 2014-03-03 00:46 +0200
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 17:18 +0000
Re: Can global variable be passed into Python function? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-01 00:58 +0000
Re: Can global variable be passed into Python function? Michael Torrie <torriem@gmail.com> - 2014-02-28 07:49 -0700
Re: Can global variable be passed into Python function? Chris Angelico <rosuav@gmail.com> - 2014-02-28 20:00 +1100
Re: Can global variable be passed into Python function? Grant Edwards <invalid@invalid.invalid> - 2014-02-28 14:20 +0000
References, and avoiding use of “variable” (was: Can global variable be passed into Python function?) Ben Finney <ben+python@benfinney.id.au> - 2014-02-28 13:46 +1100
Re: References, and avoiding use of ???variable??? (was: Can global variable be passed into Python function?) Neil Cerutti <neilc@norwich.edu> - 2014-02-28 14:30 +0000
Re: References, and avoiding use of ???variable??? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 10:33 +1100
Re: References, and avoiding use of ???variable??? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-01 16:08 +1300
Re: References, and avoiding use of ???variable??? Ben Finney <ben+python@benfinney.id.au> - 2014-03-01 15:22 +1100
Page 4 of 11 — ← Prev page 1 2 3 [4] 5 6 … 11 Next page →
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-03-02 16:55 +0000 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7587.1393779608.18130.python-list@python.org> |
| In reply to | #67455 |
On 02/03/2014 16:45, Grant Edwards wrote: > > That's irrelevent. The actual location of the memory containing the > struct object (static, stack, heap, shared) doesn't matter. The > address of the first field in a struture object _is_ the address of > the structure object. > You say struture, I'll say structure, let's call the whole thing off :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-03 06:24 +1100 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7591.1393788264.18130.python-list@python.org> |
| In reply to | #67455 |
On Mon, Mar 3, 2014 at 3:55 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > On 02/03/2014 16:45, Grant Edwards wrote: >> >> >> That's irrelevent. The actual location of the memory containing the >> struct object (static, stack, heap, shared) doesn't matter. The >> address of the first field in a struture object _is_ the address of >> the structure object. >> > > You say struture, I'll say structure, let's call the whole thing off :) :) Note that, technically, Grant is correct as long as you grant (heh) that a structure may have an invisible member, the virtual function table pointer. C++ only (I don't believe C has virtual functions - but it may have grown them in one of the newer standards), so in C, all members are public. With an array, the array's pointer *is* the same as the pointer to its first member, because adding zero to a pointer does nothing, and x <-> &x[0] <-> &(*(x+0)). ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2014-03-03 14:18 +0000 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <lf22v1$ag5$1@reader1.panix.com> |
| In reply to | #67461 |
On 2014-03-02, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Mar 3, 2014 at 3:55 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>> On 02/03/2014 16:45, Grant Edwards wrote:
>>>
>>>
>>> That's irrelevent. The actual location of the memory containing the
>>> struct object (static, stack, heap, shared) doesn't matter. The
>>> address of the first field in a struture object _is_ the address of
>>> the structure object.
>>>
>>
>> You say struture, I'll say structure, let's call the whole thing off :)
>
>:)
>
> Note that, technically, Grant is correct as long as you grant (heh)
> that a structure may have an invisible member, the virtual function
> table pointer. C++ only (I don't believe C has virtual functions -
> but it may have grown them in one of the newer standards), so in C,
> all members are public.
Yes. I was talking about C, not C++. I made that quite clear in
portions of my post that have been elided. In C there is no such
thing as a virtual table pointer.
--
Grant Edwards grant.b.edwards Yow! We have DIFFERENT
at amounts of HAIR --
gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-04 01:25 +1100 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7645.1393856724.18130.python-list@python.org> |
| In reply to | #67550 |
On Tue, Mar 4, 2014 at 1:18 AM, Grant Edwards <invalid@invalid.invalid> wrote: >> Note that, technically, Grant is correct as long as you grant (heh) >> that a structure may have an invisible member, the virtual function >> table pointer. C++ only (I don't believe C has virtual functions - >> but it may have grown them in one of the newer standards), so in C, >> all members are public. > > Yes. I was talking about C, not C++. I made that quite clear in > portions of my post that have been elided. In C there is no such > thing as a virtual table pointer. I wasn't certain of the newer C standards. C's been gaining all sorts of features, not all of which are necessary, and it's entirely possible based on my current knowledge that C specifies #include <antigravity> ... ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-02 15:17 +1100 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7561.1393733852.18130.python-list@python.org> |
| In reply to | #67356 |
On Sun, Mar 2, 2014 at 3:02 PM, Dave Angel <davea@davea.name> wrote: > The quote you make from the C standard doesn't mention malloc, so > you're arguing different things. It's not the compiler that casts > the malloc return value to the struct type. > > C++ does implicitly convert the result, and the return value of > new already has the struct type. But the runtime stores at least > two kinds of overhead on occasion, the array size, and the > vtable. So the malloc address can not be assumed to match the > struct beginning. (Not even considering that one can override Whatever pointer malloc returns is the beginning of the *usable* space. Any overhead for array size etc has to be before that; a virtual function table pointer would be inside that space, but that's very much compiler-dependent. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-03-02 08:22 -0500 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7576.1393766338.18130.python-list@python.org> |
| In reply to | #67356 |
Chris Angelico <rosuav@gmail.com> Wrote in message: > On Sun, Mar 2, 2014 at 3:02 PM, Dave Angel <davea@davea.name> wrote: >> The quote you make from the C standard doesn't mention malloc, so >> you're arguing different things. It's not the compiler that casts >> the malloc return value to the struct type. >> >> C++ does implicitly convert the result, and the return value of >> new already has the struct type. But the runtime stores at least >> two kinds of overhead on occasion, the array size, and the >> vtable. So the malloc address can not be assumed to match the >> struct beginning. (Not even considering that one can override > > Whatever pointer malloc returns is the beginning of the *usable* > space. Any overhead for array size etc has to be before that; a > virtual function table pointer would be inside that space, but that's > very much compiler-dependent. > Sure, for some definition of "usable". Overhead such as block size, freelist pointer etc., are obviously outside of the returned block. But the array size that's specified in a call to new [], and the vptr, are definitely inside the malloc'ed block, and may be before the struct data. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-03 00:57 +1100 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7579.1393770033.18130.python-list@python.org> |
| In reply to | #67356 |
On Mon, Mar 3, 2014 at 12:22 AM, Dave Angel <davea@davea.name> wrote:
> Sure, for some definition of "usable". Overhead such as block
> size, freelist pointer etc., are obviously outside of the
> returned block. But the array size that's specified in a call to
> new [], and the vptr, are definitely inside the malloc'ed block,
> and may be before the struct data.
Hmm. Last I was working with it, the array size to new[] was outside
the block, just as the block size to malloc(). The vptr is part of any
struct/class with virtual functions, and effectively acts as a hidden
class member, so you get one of those inside the block, and it's
included in sizeof.
//Allocated Space: The Final Frontier!
#include <stdio.h> //cout sucks :)
class Foo
{
int x;
int y;
int z;
};
class Bar
{
int x;
int y;
int z;
virtual int get_x() {return x;}
};
int main()
{
printf("sizeof(int) = %u\n",sizeof(int));
printf("sizeof(int*) = %u\n",sizeof(int*));
printf("sizeof(Foo) = %u\n",sizeof(Foo));
printf("sizeof(Bar) = %u\n",sizeof(Bar));
Foo *foo = new Foo[10];
printf("foo = %p/%p = %u\n",foo,foo+10,(char *)(foo+10)-(char *)foo);
Bar *bar = new Bar[10];
printf("bar = %p/%p = %u\n",bar,bar+10,(char *)(bar+10)-(char *)bar);
return 0;
}
rosuav@sikorsky:~$ g++ frontier.cpp && ./a.out
sizeof(int) = 4
sizeof(int*) = 8
sizeof(Foo) = 12
sizeof(Bar) = 24
foo = 0xf38010/0xf38088 = 120
bar = 0xf38090/0xf38180 = 240
The rules of structs are that they be contiguous, that they be laid
out sequentially, and that any padding needed between structures is at
the end of the previous one (which is why three of 4 bytes makes 12
bytes, but three of 4 bytes plus 8 bytes makes 24 - the eight-byte
pointer has to be aligned on a multiple of eight bytes, so having a
20-byte structure that starts with an 8-byte pointer is a no-no). The
allocated block of memory is, by definition, the same as the pointer
to its first element. As it happens, the pointer bar is not synonymous
with &bar->x, &bar->y, or &bar->z, which means the vptr is at the
beginning of bar, which makes sense; but the compiler's not obliged to
do that, and in some cases may choose not to - for instance, if bar
(with a virtual function) inherited from foo (with none), it might be
convenient to allow a pointer-cast to not change the value of the
pointer. (g++ 4.7.2 still puts the vptr at the beginning of bar in
that case, but other compilers or other versions may differ.)
Array size is outside the block, presumably before it, as &foo[0] is
by definition identical to foo, and there's no room inside the
structure for any spare data. Virtual function table is inside the
block because it's a hidden member of the object (like __class__ in
Python, only better hidden).
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-03-02 14:17 -0500 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7590.1393787621.18130.python-list@python.org> |
| In reply to | #67356 |
Chris Angelico <rosuav@gmail.com> Wrote in message:
> On Mon, Mar 3, 2014 at 12:22 AM, Dave Angel <davea@davea.name> wrote:
>> Sure, for some definition of "usable". Overhead such as block
>> size, freelist pointer etc., are obviously outside of the
>> returned block. But the array size that's specified in a call to
>> new [], and the vptr, are definitely inside the malloc'ed block,
>> and may be before the struct data.
>
> Hmm. Last I was working with it, the array size to new[] was outside
> the block, just as the block size to malloc(). The vptr is part of any
> struct/class with virtual functions, and effectively acts as a hidden
> class member, so you get one of those inside the block, and it's
> included in sizeof.
>
> //Allocated Space: The Final Frontier!
> #include <stdio.h> //cout sucks :)
>
> class Foo
> {
> int x;
> int y;
> int z;
> };
>
> class Bar
> {
> int x;
> int y;
> int z;
> virtual int get_x() {return x;}
> };
>
> int main()
> {
> printf("sizeof(int) = %u\n",sizeof(int));
> printf("sizeof(int*) = %u\n",sizeof(int*));
> printf("sizeof(Foo) = %u\n",sizeof(Foo));
> printf("sizeof(Bar) = %u\n",sizeof(Bar));
> Foo *foo = new Foo[10];
> printf("foo = %p/%p = %u\n",foo,foo+10,(char *)(foo+10)-(char *)foo);
> Bar *bar = new Bar[10];
> printf("bar = %p/%p = %u\n",bar,bar+10,(char *)(bar+10)-(char *)bar);
> return 0;
> }
>
>
> rosuav@sikorsky:~$ g++ frontier.cpp && ./a.out
> sizeof(int) = 4
> sizeof(int*) = 8
> sizeof(Foo) = 12
> sizeof(Bar) = 24
> foo = 0xf38010/0xf38088 = 120
> bar = 0xf38090/0xf38180 = 240
>
>
>
> The rules of structs are that they be contiguous, that they be laid
> out sequentially, and that any padding needed between structures is at
> the end of the previous one (which is why three of 4 bytes makes 12
> bytes, but three of 4 bytes plus 8 bytes makes 24 - the eight-byte
> pointer has to be aligned on a multiple of eight bytes, so having a
> 20-byte structure that starts with an 8-byte pointer is a no-no). The
> allocated block of memory is, by definition, the same as the pointer
> to its first element. As it happens, the pointer bar is not synonymous
> with &bar->x, &bar->y, or &bar->z, which means the vptr is at the
> beginning of bar, which makes sense; but the compiler's not obliged to
> do that, and in some cases may choose not to - for instance, if bar
> (with a virtual function) inherited from foo (with none), it might be
> convenient to allow a pointer-cast to not change the value of the
> pointer. (g++ 4.7.2 still puts the vptr at the beginning of bar in
> that case, but other compilers or other versions may differ.)
>
> Array size is outside the block, presumably before it, as &foo[0] is
> by definition identical to foo, and there's no room inside the
> structure for any spare data. Virtual function table is inside the
> block because it's a hidden member of the object (like __class__ in
> Python, only better hidden).
>
Array size is inside the malloc block, but outside the struct
block. As you can see if you try to delete without the brackets
when you used new [], some runtimes will crash.
This is not to say that there will always be these extra offsets,
just that they can be there.
--
DaveA
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-03 06:32 +1100 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7593.1393788751.18130.python-list@python.org> |
| In reply to | #67356 |
On Mon, Mar 3, 2014 at 6:17 AM, Dave Angel <davea@davea.name> wrote:
> Array size is inside the malloc block, but outside the struct
> block. As you can see if you try to delete without the brackets
> when you used new [], some runtimes will crash.
As in, you have to use "delete [] x" to correspond with "x = new
whatever[n]"? Yes, that's right, but that array size is earlier in
memory than x itself. I can pretend that x is the same as one declared
statically as "whatever x[n]", and it'll function the same way. When
new[] is implemented using malloc(), it'll be something like this:
{
data = malloc(n * sizeof(whatever) + sizeof n);
*(int *)data = n;
return ((int *)data)+1;
}
so in that case, the array size is inside the malloc'd block, but it's
still invisible to the calling function. A fully compliant C++
implementation could choose to store that elsewhere, in some kind of
lookup table - it could then easily catch bugs like "delete
malloc(1)", "delete [] malloc(1)", "delete [] new whatever", and
"delete new whatever[1]" (because the pointer given wouldn't be in the
'new' table or the 'new[]' table, respectively).
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-03-02 17:58 -0500 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7599.1393800877.18130.python-list@python.org> |
| In reply to | #67356 |
Chris Angelico <rosuav@gmail.com> Wrote in message: > > } > > so in that case, the array size is inside the malloc'd block, but it's > still invisible to the calling function. > Please quit using negative language when you're so vehemently agreeing with me. The data is sometimes not at the beginning of the malloc'ed block. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | random832@fastmail.us |
|---|---|
| Date | 2014-02-24 13:20 -0500 |
| Message-ID | <mailman.7320.1393266022.18130.python-list@python.org> |
| In reply to | #66987 |
On Mon, Feb 24, 2014, at 13:05, j.e.haque@gmail.com wrote:
> typedef struct {
> int value;
> } Number;
>
> Number *o;
> o = malloc(sizeof(*o));
> o->value=3;
> printf("o<%p>, o->value<%p>\n", o, &o->value);
>
> o<0x9fe5008>, o->value<0x9fe5008>
>
> Is the compiler borked?
That's cheating. Try printf("o<%p>", &o);
[toc] | [prev] | [next] | [standalone]
| From | random832@fastmail.us |
|---|---|
| Date | 2014-02-24 13:21 -0500 |
| Subject | Re: [OT] Can global variable be passed into Python function? |
| Message-ID | <mailman.7321.1393266109.18130.python-list@python.org> |
| In reply to | #66987 |
On Mon, Feb 24, 2014, at 13:19, Michael Torrie wrote: > Why would you think that? The address of the start of your malloc'ed > structure is the same as the address of the first element. Surely this > is logical? And of course all this is quite off topic. That's not helpful - the problem, in context, is that he doesn't understand that the fact that the structure exists at that address is not the same thing as the variable "o" existing at that address.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-02-25 05:22 +1100 |
| Message-ID | <mailman.7322.1393266155.18130.python-list@python.org> |
| In reply to | #66987 |
On Tue, Feb 25, 2014 at 5:05 AM, <j.e.haque@gmail.com> wrote:
> typedef struct {
> int value;
> } Number;
>
> Number *o;
> o = malloc(sizeof(*o));
> o->value=3;
> printf("o<%p>, o->value<%p>\n", o, &o->value);
>
> o<0x9fe5008>, o->value<0x9fe5008>
>
> Is the compiler borked?
No, because a structure in C is simply a laying-out of its members. A
pointer to the structure is exactly the same as a pointer to its first
member, same as a pointer to an array is really just a pointer to its
first element (with other elements laid out sequentially, possibly
with padding for alignment). In Python, a complex object is a thing in
its own right; it has an identity and a set of members, each of which
has its own identity. In C, the structure is an invisible piece of
nothingness that surrounds an aggregation of other objects. For
instance:
typedef struct {
int val1;
int val2;
} NumberPair;
NumberPair five_pairs[5];
int *ten_ints = (int *)five_pairs;
This is considered naughty (pointer aliasing), and can make a mess of
optimization, but as far as I know, it's never going to be a problem
(I don't think it's possible for there to be any padding between two
ints; it's possible the struct will demand coarser alignment than the
ints would, which is why I've written them in that order). You can
access ten integers from the aliased pointer, and five pairs of
integers through the original structure array, and they're all exactly
the same. If you print out those two pointers, they will have the same
value in them, and &five_pairs[3]->val2 will be the same as
&ten_ints[7] (and the same as ten_ints+7).
For in C, neither the structure nor the non-structure is anything. The
only thing that counts is code expressing itself through love.
(Galatians 5:6, K&R translation. Or something like that.)
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-02-25 05:25 +1100 |
| Message-ID | <mailman.7324.1393266334.18130.python-list@python.org> |
| In reply to | #66987 |
On Tue, Feb 25, 2014 at 5:20 AM, <random832@fastmail.us> wrote:
> On Mon, Feb 24, 2014, at 13:05, j.e.haque@gmail.com wrote:
>> typedef struct {
>> int value;
>> } Number;
>>
>> Number *o;
>> o = malloc(sizeof(*o));
>> o->value=3;
>> printf("o<%p>, o->value<%p>\n", o, &o->value);
>>
>> o<0x9fe5008>, o->value<0x9fe5008>
>>
>> Is the compiler borked?
>
> That's cheating. Try printf("o<%p>", &o);
It's not cheating, but it's showing something different. Comparing o
and &o->value shows that the structure itself and its first member are
at the same location in memory. Comparing o and &o shows that the
structure and the pointer to the structure are at different locations
in memory.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-02-24 20:00 +0000 |
| Message-ID | <mailman.7330.1393272308.18130.python-list@python.org> |
| In reply to | #66987 |
On 24/02/2014 18:05, j.e.haque@gmail.com wrote:
> On Sunday, February 23, 2014 5:01:25 AM UTC-6, Marko Rauhamaa wrote:
>> Chris Angelico <rosuav@gmail.com>:
>>
>>> That's the exact line of thinking that leads to problems. You are not
>>
>>> placing a number at the address "xyz", you are pointing the name "xyz"
>>
>>> to the number 3. That number still exists elsewhere.
>>
>>
>>
>> And?
>>
>>
>>
>> In C, I can say:
>>
>>
>>
>> Number *o = malloc(sizeof *o);
>>
>> o->value = 3;
>>
>>
>>
>> Your statement is valid: the number 3 resides elsewhere than the
>>
>> variable o.
>
> typedef struct {
> int value;
> } Number;
>
> Number *o;
> o = malloc(sizeof(*o));
> o->value=3;
> printf("o<%p>, o->value<%p>\n", o, &o->value);
>
> o<0x9fe5008>, o->value<0x9fe5008>
>
> Is the compiler borked?
>
I can't be bothered to check. OTOH google groups is so please read and
action this https://wiki.python.org/moin/GoogleGroupsPython, thanks.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-02-22 10:02 -0500 |
| Message-ID | <mailman.7264.1393081109.18130.python-list@python.org> |
| In reply to | #66792 |
Mark Lawrence <breamoreboy@yahoo.co.uk> Wrote in message: > On 22/02/2014 02:47, Dennis Lee Bieber wrote: >> BASIC, C, FORTRAN, COBOL, Assembly... A "variable" is synonym for an >> address [a box that holds things]. >> > > In C. > > int xyz = 1; > > xyz is placed in a register. What is xyz called now as it's not in memory? Don't know why you'd assume it's a register. It could just as well be nowhere. If a later reference in the same function adds it to something else, there might not need to be any hardware anywhere representing the value 1. Once you turn on a C optimizer, the real existence of local values is not assured. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-02-22 13:03 -0500 |
| Message-ID | <mailman.7265.1393092241.18130.python-list@python.org> |
| In reply to | #66792 |
On Sat, 22 Feb 2014 14:15:22 +0000, Mark Lawrence <breamoreboy@yahoo.co.uk>
declaimed the following:
>On 22/02/2014 02:47, Dennis Lee Bieber wrote:
>> BASIC, C, FORTRAN, COBOL, Assembly... A "variable" is synonym for an
>> address [a box that holds things].
>>
>
>In C.
>
>int xyz = 1;
>
>xyz is placed in a register. What is xyz called now as it's not in memory?
On the Xerox Sigma computers, the registers mapped to the first 16
(32-bit) words of memory...
Even ignoring that and treating registers as separate from memory, and
assuming the compiler didn't optimize xyz completely out of existence, xyz
is still a synonym for an address -- in this case an address in the
register bank, which is still a box that holds things, rather than in an
external memory.
As I recall, to handle garbage collection, Apple used to use two stage
look ups... The user variable (handle) was a reference into a table of
handles, and each entry in that table was a reference to the real object
out in memory. Garbage collection would move the objects around to compact
used memory, updating the address in the table -- the user program never
sees the object moving as its handle address never changed.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-02-23 00:39 +0000 |
| Message-ID | <53094348$0$29985$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #66901 |
On Sat, 22 Feb 2014 13:03:33 -0500, Dennis Lee Bieber wrote: > As I recall, to handle garbage collection, Apple used to use two stage > look ups... The user variable (handle) was a reference into a table of > handles, and each entry in that table was a reference to the real object > out in memory. Garbage collection would move the objects around to > compact used memory, updating the address in the table -- the user > program never sees the object moving as its handle address never > changed. Yes, but that was not transparent to the user. You actually had to explicitly use the Mac Toolbox memory routines to allocate memory, create and destroy handles, etc. If you just used your programming language's normal pointers, they couldn't and wouldn't move. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-22 19:57 -0500 |
| Message-ID | <roy-C517B8.19575422022014@news.panix.com> |
| In reply to | #66901 |
In article <mailman.7265.1393092241.18130.python-list@python.org>, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > On the Xerox Sigma computers, the registers mapped to the first 16 > (32-bit) words of memory... The pdp-11 did that too (although, that may have been a model-specific thing). > As I recall, to handle garbage collection, Apple used to use two stage > look ups... The user variable (handle) was a reference into a table of > handles, and each entry in that table was a reference to the real object > out in memory. Garbage collection would move the objects around to compact > used memory, updating the address in the table -- the user program never > sees the object moving as its handle address never changed. Yup, that was the pre-OSX days. You could get at the raw pointers if you needed to, but you had to explicitly lock the handle, and unlock it when you were done.
[toc] | [prev] | [next] | [standalone]
| From | "Mark H. Harris" <harrismh777@gmail.com> |
|---|---|
| Date | 2014-02-27 05:24 -0800 |
| Message-ID | <bd36a46b-d704-4eb1-9b7d-1308d1fb6699@googlegroups.com> |
| In reply to | #66792 |
On Friday, February 21, 2014 12:37:59 AM UTC-6, Sam wrote:
> I need to pass a global variable into a python function. However, the global variable does not seem to be assigned after the function ends. Is it because parameters are not passed by reference? How can I get function parameters to be passed by reference in Python?
def func(x):
global ref_name
ref_name = '3.14159'
# rest of the code
# rest of the code
When you call this function the ref_name reference will be set to '3.14159' as a string and your main code will be able to 'see' it, and other funcs will be able to 'see' it too... play with it a bit... if other funcs need to write to it they will also have to use the global ref_name line. As long as other funcs only read the reference, then the global line is not needed to 'see' the reference.
As others have noted, python does not have a 'variable' concept (references to objects instead) and so your question is a little ambiguous.
Also, using global references within functions is not a good idea... generally speaking.
Cheers
[toc] | [prev] | [next] | [standalone]
Page 4 of 11 — ← Prev page 1 2 3 [4] 5 6 … 11 Next page →
Back to top | Article view | comp.lang.python
csiph-web