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: Wed, 8 Jun 2016 11:41:20 +0200 Lines: 45 Message-ID: References: <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de jYoZhjlzzL0h71nuDhwmJAhjvK0OOa0GblvBm/WmPyBw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'received:134': 0.05; 'assignment': 0.07; 'imply': 0.07; '34,': 0.09; '[0,': 0.09; 'effect.': 0.09; 'semantics': 0.09; 'python': 0.10; 'python.': 0.11; 'variables': 0.15; 'wednesday': 0.15; '2016': 0.16; 'assignment.': 0.16; 'assignments': 0.16; 'describing': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'route,': 0.16; 'wrote:': 0.16; 'either.': 0.22; 'parameter': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; '13,': 0.29; 'print': 0.30; 'received:be': 0.30; "can't": 0.32; 'steven': 0.33; 'similar': 0.33; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'seem': 0.37; 'does': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'course': 0.62; 'to,': 0.63; "d'aprano:": 0.84; 'pardon': 0.84; 'schreef': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIIAHYeUleGuA9G/2dsb2JhbABehFsBvRCGEgKCAAEBAQEBAWaEbAEBAQMBI1sLCxgCAgUhAgIPAkYTCAKIIwixTY0+g1sBAQgCJYEBhSaETYUMgjWCWQWYRYFXjE2JM4Vpj1JUg3CKfgEBAQ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 In-Reply-To: <5757dbaf$0$1615$c3e8da3$5496439d@news.astraweb.com> 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: <5757E840.80805@rece.vub.ac.be> X-Mailman-Original-References: <5753c89b$0$1616$c3e8da3$5496439d@news.astraweb.com> <1465148542.2670061.628500777.62F1EFE1@webmail.messagingengine.com> <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> Xref: csiph.com comp.lang.python:109667 Op 08-06-16 om 10:47 schreef Steven D'Aprano: > On Wednesday 08 June 2016 17:53, Antoon Pardon wrote: > >> Python could go the simula route, which has two kinds of >> assignment. One with the python semantics and one with C >> semantics. >> >> Let as use := for the C sematics assignment and <- for the >> python sematics assignment. We could then do something like >> the following. >> >> ls := [5, 8, 13, 21] >> a <- ls[2] >> a := 34 >> print ls # [5, 8, 34, 21] > What you seem to be describing is similar to reference parameter semantics from > Pascal. Assignment doesn't work that way in C, or Python. I disagree. In python the assignment does work similar to the reference parameter semantics in pascal. See the following A = range[4] B = A B[2] = 5 print A # [0, 1, 5, 2] This is exactly the result you would get with B as a reference parameter in pascal. > And of course Python doesn't have reference variables either. There is nothing > you can do in Python to get this effect: > > a = 1 > b = a > b = 99 > assert a == 99 It is true that you can't get such an effect in python, but that doesn't imply that python doesn't have reference variables (as an abstract notion). Because having reference variables doesn't imply you can have that effect. If all you have is reference variables and assignments just change what object is refered to, you can't have such an effect either. -- Antoon Pardon.