Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Antoon Pardon Newsgroups: comp.lang.python Subject: Re: I'm wrong or Will we fix the ducks limp? Date: Thu, 9 Jun 2016 09:30:41 +0200 Lines: 51 Message-ID: References: <5754f36b$0$1619$c3e8da3$5496439d@news.astraweb.com> <1465186088.3554819.628831041.19D0DC8D@webmail.messagingengine.com> <575599f4$0$1595$c3e8da3$5496439d@news.astraweb.com> <57569f6a$0$11124$c3e8da3@news.astraweb.com> <5756BED8.2000304@rece.vub.ac.be> <1465313620.1380508.630546953.7F7E755D@webmail.messagingengine.com> <5757CF15.4010002@rece.vub.ac.be> <5757dbaf$0$1615$c3e8da3$5496439d@news.astraweb.com> <5757E840.80805@rece.vub.ac.be> <5757FB1B.5000502@rece.vub.ac.be> <5758292E.2020600@rece.vub.ac.be> <871t474ox1.fsf@elektro.pacujo.net> <57591B21.7050509@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de Ske7RxZk1ujyKafFa3WYdQMkKiQCzxdvkQ7fGVzt+vhQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'received:134': 0.05; 'differently': 0.07; 'behave': 0.09; 'pointers': 0.09; 'variables,': 0.09; 'python': 0.10; 'python.': 0.11; 'variables': 0.15; 'assignment.': 0.16; 'assignments.': 0.16; 'attribute,': 0.16; 'evaluates': 0.16; 'pointers,': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simulated': 0.16; 'pointer': 0.18; 'variable': 0.18; 'assign': 0.22; 'object.': 0.22; 'variables.': 0.22; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'pointer.': 0.29; 'subset': 0.29; 'thus,': 0.29; 'environment': 0.29; 'received:be': 0.30; 'extend': 0.31; 'operations': 0.31; 'generally': 0.32; 'maybe': 0.33; 'similar': 0.33; 'something': 0.35; 'but': 0.36; 'lines': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'doing': 0.38; 'no,': 0.38; 'copying': 0.38; 'subject:the': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'share': 0.61; 'yes': 0.62; 'different': 0.63; 'other.': 0.64; 'sharing': 0.64; 'between': 0.65; 'detail.': 0.66; 'forward': 0.66; 'pardon': 0.84; 'schreef': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArQIAHYeUleGuA9G/2dsb2JhbABehFsBMbxfhhICggABAQEBAQFmhG0BAQQjVRELGgIFFgsCAgkDAgECAUUTBgICiCuxTY0+g1sBAQgCJYEBhSaETYQccII1glkFmEWBV4xNiTOFaY9SVINwbAGITYFEAQEB User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 In-Reply-To: <871t474ox1.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <57591B21.7050509@rece.vub.ac.be> X-Mailman-Original-References: <5754f36b$0$1619$c3e8da3$5496439d@news.astraweb.com> <1465186088.3554819.628831041.19D0DC8D@webmail.messagingengine.com> <575599f4$0$1595$c3e8da3$5496439d@news.astraweb.com> <57569f6a$0$11124$c3e8da3@news.astraweb.com> <5756BED8.2000304@rece.vub.ac.be> <1465313620.1380508.630546953.7F7E755D@webmail.messagingengine.com> <5757CF15.4010002@rece.vub.ac.be> <5757dbaf$0$1615$c3e8da3$5496439d@news.astraweb.com> <5757E840.80805@rece.vub.ac.be> <5757FB1B.5000502@rece.vub.ac.be> <5758292E.2020600@rece.vub.ac.be> <871t474ox1.fsf@elektro.pacujo.net> Xref: csiph.com comp.lang.python:109703 Op 08-06-16 om 18:37 schreef Marko Rauhamaa: > Antoon Pardon : > >> You can do something like that in simula, but only because >> simula has two kinds of assignments. One kind that is >> simular to python and one that is similar to C. >> The one that is similar that python is the reference assignment. > I see Python as doing the exact same thing with variables as C. > > What is different is that in Python, every expression evaluates to a > pointer. Thus, you can only assign pointers to variables. Then you think wrong. Python has no pointers, that is an implementation detail. In python when you have two variables, and you assign one to the other you then have two variables that share an object. In C when you have two variables and you assign one to the other you then have two variable each refering to their own object that are copies of each other. And yes that sharing of variables in python can be simulated by copying pointers in C. Maybe the simularities between variables in python can be made isomorphic with a specific subset of pointer operations in C. The fact is that such an isomorphism would be limited to specific pointer operations and would not extend to how variable generally behave in C. In a rather straight forward environment with classes/structs that have an x and y attribute, the following lines behave differently in C and Python. A.x = 1; A.y = 2; B = A; B.x = 3; B.y = 4; In C the variable A will still be x:1, y:2. In Python the variable A will be x:3, y:4. So no, Python doesn't do the exact same thing with variables as C. -- Antoon Pardon.