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


Groups > comp.lang.python > #71217

Re: Values and objects

Path csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'parameters': 0.04; 'definitions': 0.07; 'memory.': 0.07; 'suppose': 0.07; 'variables': 0.07; 'key.': 0.09; 'must,': 0.09; 'variable,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "(it's": 0.16; 'callee': 0.16; 'definitions,': 0.16; 'dict': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'malloc': 0.16; 'patches': 0.16; 'run-time.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'passing': 0.19; 'shape': 0.19; 'memory': 0.22; '(in': 0.22; 'cc:addr:python.org': 0.22; 'issue,': 0.24; 'pointer': 0.24; 'cc:2**0': 0.24; 'define': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'patch': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:wiki': 0.31; 'parameters.': 0.31; 'url:wikipedia': 0.31; 'values.': 0.31; 'comment': 0.34; 'more,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'combination': 0.36; 'returning': 0.36; 'url:org': 0.36; 'represent': 0.38; 'pm,': 0.38; 'how': 0.40; 'ensure': 0.60; 'continued': 0.60; 'life,': 0.60; 'most': 0.60; 'more': 0.64; 'effectively': 0.66; 'results': 0.69; 'fact,': 0.69; 'liking': 0.84; 'proves': 0.84; 'whereas': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=m2Znpwi51SL4l74WtM7+gy5556/XLl/jDFhqZ4W2twI=; b=OLyUmvxbGD+UtNRbTli2IKYVyLgidh24c5mjA+P9YD4xDmh1KuFBJtC/P5WKgOzszP 4V+Aza7S5V0xK/BfE33fZ3oe8G4mbf7e1yPsVDQe0Ao9gTFAKqAYGFEf69gAuywhMTQT zSgFoUBIF63SytgU8UWM4XuI8LQk6zY78glnR3IY/h/now88zZoxzqoOeB+Va7z11feN JWq/vjl5O7Y01qmr+7gCx+Sywu0I45ozTPqEdjVNt5X6d+/4z18DaSFA9y8FIQT9OyHT g+/P8rYbqfj9gEVr0Zfmcl0I4xAZB/4Pb4U04Rgc0lHMHbbGm6xRanoStO0CBoKF1bZe Pjdw==
MIME-Version 1.0
X-Received by 10.52.2.229 with SMTP id 5mr9300936vdx.24.1399689208154; Fri, 09 May 2014 19:33:28 -0700 (PDT)
In-Reply-To <9cc0ebf9-dbed-4d3d-91fc-2abb9b0103d0@googlegroups.com>
References <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> <5368681D.8070602@islandtraining.com> <mailman.9710.1399408799.18130.python-list@python.org> <lkbigv$ban$1@speranza.aioe.org> <mailman.9713.1399419985.18130.python-list@python.org> <lkdt0u$moc$1@speranza.aioe.org> <87ppjpwafk.fsf@elektro.pacujo.net> <536ad8f2$0$29965$c3e8da3$5496439d@news.astraweb.com> <lkjitj$d0c$1@speranza.aioe.org> <87zjiqbmy5.fsf@elektro.pacujo.net> <536d7a7d$0$29980$c3e8da3$5496439d@news.astraweb.com> <9cc0ebf9-dbed-4d3d-91fc-2abb9b0103d0@googlegroups.com>
Date Sat, 10 May 2014 12:33:28 +1000
Subject Re: Values and objects
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9841.1399689216.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1399689216 news.xs4all.nl 2962 [2001:888:2000:d::a6]:46149
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71217

Show key headers only | View raw


On Sat, May 10, 2014 at 12:19 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> For me, Marko's comment that variables in python are not first-class
> whereas in C they are is for me the most important distinction Ive seen
> (in a long time of seeing these discussions).
>

https://en.wikipedia.org/wiki/First-class_citizen

For variables in C to be considered first-class, they must, by most
definitions, be able to be passed around as parameters and return
values. Some definitions also require that they be able to be
constructed at run-time. How do C variables shape up?

1) Passing them as parameters. You can pass a pointer to a variable,
which is effectively the same as passing a variable to a function. The
callee can mutate your variable through the pointer.
2) Returning them. This is a lot more dodgy, owing to the
dangling-pointer issue, but as long as you accept that the reference
to a variable doesn't ensure its continued life, I suppose this might
be acceptable. Maybe. But it's pushing it.
3) Constructing at run-time. Really REALLY pushing it. You can malloc
and call that a "variable", but it's not a variable any more, it's
just a patch of memory. In fact, all this proves is that variables
represent patches of memory, and patches of memory are first-class.

Not liking the results here. You might just as well define that all
Python variables must be backed by a dictionary (it's just as true as
"all C variables must be backed by memory") and then define the
first-class-variable as a combination of a dict and a key.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Pass variable by reference Ned Batchelder <ned@nedbatchelder.com> - 2014-05-06 16:31 -0400
  Re: Pass variable by reference Mark H Harris <harrismh777@gmail.com> - 2014-05-06 16:00 -0500
    Re: Pass variable by reference Ned Batchelder <ned@nedbatchelder.com> - 2014-05-06 17:27 -0400
    Re: Pass variable by reference Chris Angelico <rosuav@gmail.com> - 2014-05-07 09:46 +1000
      Re: Pass variable by reference Rustom Mody <rustompmody@gmail.com> - 2014-05-06 19:18 -0700
        Re: Pass variable by reference Chris Angelico <rosuav@gmail.com> - 2014-05-07 12:39 +1000
          Re: Pass variable by reference Rustom Mody <rustompmody@gmail.com> - 2014-05-06 19:54 -0700
            Re: Pass variable by reference Steven D'Aprano <steve@pearwood.info> - 2014-05-07 04:59 +0000
      Re: Pass variable by reference Mark H Harris <harrismh777@gmail.com> - 2014-05-07 13:11 -0500
        Re: Pass variable by reference Marko Rauhamaa <marko@pacujo.net> - 2014-05-08 00:22 +0300
          Values and objects [was Re: Pass variable by reference] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-08 01:08 +0000
            Re: Values and objects [was Re: Pass variable by reference] Mark H Harris <harrismh777@gmail.com> - 2014-05-09 16:56 -0500
              Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-10 01:34 +0300
                Re: Values and objects Ben Finney <ben@benfinney.id.au> - 2014-05-10 10:24 +1000
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 01:01 +0000
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-09 19:19 -0700
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-10 12:33 +1000
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-09 20:05 -0700
                Re: Values and objects Mark H Harris <harrismh777@gmail.com> - 2014-05-09 23:15 -0500
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 06:15 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-10 17:21 +1000
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 09:09 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-10 19:32 +1000
                Re: Values and objects Ethan Furman <ethan@stoneleaf.us> - 2014-05-10 12:10 -0700
                Re: Values and objects MRAB <python@mrabarnett.plus.com> - 2014-05-10 20:22 +0100
                Re: Values and objects Ethan Furman <ethan@stoneleaf.us> - 2014-05-10 12:28 -0700
                Re: Values and objects Terry Reedy <tjreedy@udel.edu> - 2014-05-10 16:16 -0400
                Re: Values and objects Terry Reedy <tjreedy@udel.edu> - 2014-05-10 16:24 -0400
                Re: Values and objects Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-05-10 14:03 -0700
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 03:17 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-11 13:30 +1000
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 05:11 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-11 15:22 +1000
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-10 22:31 -0700
                Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-11 09:21 +0300
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-10 23:48 -0700
                Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-11 18:10 +0300
                Re: Values and objects Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-05-11 11:26 +0300
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-11 01:48 -0700
                Re: Values and objects Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-05-11 15:22 +0300
                Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-11 18:46 +0300
                Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-11 22:56 +0300
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 12:51 +0000
                Re: Values and objects Rustom Mody <rustompmody@gmail.com> - 2014-05-11 07:12 -0700
                Re: Values and objects Ethan Furman <ethan@stoneleaf.us> - 2014-05-10 22:42 -0700
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 06:40 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-11 09:18 +1000
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 03:11 +0000
                Re: Values and objects Rotwang <sg552@hotmail.co.uk> - 2014-05-11 14:46 +0100
                Re: Values and objects Ned Batchelder <ned@nedbatchelder.com> - 2014-05-11 14:40 -0400
                Re: Values and objects Rotwang <sg552@hotmail.co.uk> - 2014-05-12 00:06 +0100
                Re: Values and objects Ethan Furman <ethan@stoneleaf.us> - 2014-05-10 18:28 -0700
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 07:24 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-11 11:59 +1000
                Re: Values and objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-11 07:29 +0000
                Re: Values and objects Ethan Furman <ethan@stoneleaf.us> - 2014-05-10 21:46 -0700
                Re: [Python-Dev] Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-11 16:08 +1000
                Re: Values and objects albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-17 14:26 +0000
                Re: Values and objects Chris Angelico <rosuav@gmail.com> - 2014-05-10 11:58 +1000
                Re: Values and objects Marko Rauhamaa <marko@pacujo.net> - 2014-05-10 10:57 +0300
                Re: Values and objects Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-05-10 11:06 +0300
                Re: Values and objects Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-05-10 12:07 -0400
        Re: Pass variable by reference Chris Angelico <rosuav@gmail.com> - 2014-05-08 11:31 +1000
          Re: Pass variable by reference Mark H Harris <harrismh777@gmail.com> - 2014-05-09 17:30 -0500
            Abstractions [was Re: Pass variable by reference] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 00:58 +0000
              Re: Abstractions [was Re: Pass variable by reference] Mark H Harris <harrismh777@gmail.com> - 2014-05-09 21:17 -0500
  Re: Pass variable by reference Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-07 01:14 +0000

csiph-web