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 12:19:35 +0200 Lines: 34 Message-ID: References: <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> <87inxipvmk.fsf@elektro.pacujo.net> <575942B7.5030905@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 OONKkScockJqvTvqchNQnAsexWAyOxiWqmT8xbAmgHvA== Return-Path: 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; 'python,': 0.02; 'received:134': 0.05; 'differently': 0.07; 'behave': 0.09; 'int.': 0.09; 'python': 0.10; 'python.': 0.11; 'languages,': 0.15; 'languages.': 0.15; 'variables': 0.15; '11:19': 0.16; 'attribute,': 0.16; 'different,': 0.16; 'evaluates': 0.16; 'expressions.': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'variable': 0.18; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'environment': 0.29; 'received:be': 0.30; 'something': 0.35; 'but': 0.36; 'lines': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'difference': 0.38; 'no,': 0.38; 'subject:the': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'different': 0.63; 'forward': 0.66; 'schreef': 0.84; 'struct.': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIIAHYeUleGuA9G/2dsb2JhbABehFsBvRCGEgKCAAEBAQEBAWaEbQEBBCNVEQsaAgUWCwICCQMCAQIBRRMIAogrsU2NPoNbAQEIAiWBAYUmhE2FDII1glkBBJhFgVeMTYkzhWmPUlSDcIp+AQEB User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 In-Reply-To: <87inxipvmk.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: <575942B7.5030905@rece.vub.ac.be> X-Mailman-Original-References: <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> <87inxipvmk.fsf@elektro.pacujo.net> Xref: csiph.com comp.lang.python:109723 Op 09-06-16 om 11:19 schreef Marko Rauhamaa: > >> 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. > The difference is not in the variables but in the expressions. In > Python, > > 1 > > evaluates to a pointer; in C, it evaluates to an int. Furthermore, in > Python, > > A > > evaluates to a pointer; in C, it evaluates to a struct. If a variable evaluates to something different, in different languages, the variable don't do the exact same thing in the different languages.