Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail 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; 'sys': 0.05; 'subject: + ': 0.07; 'url:github': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.10; 'passing': 0.15; 'value.': 0.15; '(must': 0.16; 'driscoll': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'literals': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'reason.': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'which,': 0.16; 'wrote:': 0.17; 'parameters': 0.20; 'import': 0.21; 'ctypes': 0.22; 'modifying': 0.22; 'cc:no real name:2**0': 0.24; 'paul': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'values': 0.26; 'guess': 0.27; 'probably': 0.29; 'function': 0.30; 'science,': 0.33; 'false': 0.35; 'skip:f 40': 0.35; 'too.': 0.35; 'brian': 0.36; 'received:au': 0.36; 'charset:us-ascii': 0.36; 'author': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'content-disposition:inline': 0.60; 'stand': 0.61; 'feet.': 0.84; 'heh.': 0.84; 'isaac': 0.84; 'shoulders': 0.84; 'standing': 0.84; 'giants': 0.91 Date: Thu, 5 Jul 2012 12:06:07 +1000 From: Cameron Simpson To: Evan Driscoll Subject: Re: 2 + 2 = 5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FF4E239.8060603@cs.wisc.edu> User-Agent: Mutt/1.5.21 (2010-09-15) References: <4FF4E239.8060603@cs.wisc.edu> Cc: python-list@python.org, Paul Rubin X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341454467 news.xs4all.nl 6924 [2001:888:2000:d::a6]:47770 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24890 On 04Jul2012 19:39, Evan Driscoll wrote: | On 7/4/2012 14:37, Paul Rubin wrote: | > I just came across this (https://gist.github.com/1208215): | > | > import sys | > import ctypes | > pyint_p = ctypes.POINTER(ctypes.c_byte*sys.getsizeof(5)) | > five = ctypes.cast(id(5), pyint_p) | > print(2 + 2 == 5) # False | > five.contents[five.contents[:].index(5)] = 4 | > print(2 + 2 == 5) # True (must be sufficiently large values of 2 there...) | > | > Heh. The author is apparently anonymous, I guess for good reason. | | Probably just nostalgic for old Fortran, which, supposedly, allowed you | to change the values of literals by passing them to a function by | reference and then modifying the value. Yeah, I was thinking that too. Because all parameters were pass-by-reference in early fortran IIRC. You could, for example, set pi to 3. -- Cameron Simpson If I have seen farther than others, it is because I was standing on the shoulders of giants. - Isaac Newton If I have not seen as far as others, it is because giants were standing on my shoulders. - Hal Abelson In computer science, we stand on each other's feet. - Brian K. Reed