Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'sys': 0.05; 'subject: + ': 0.07; 'url:blog': 0.09; 'url:github': 0.09; '(must': 0.16; 'reason.': 0.16; 'received:192.168.1.50': 0.16; 'wrote:': 0.17; 'import': 0.21; 'back.': 0.22; 'ctypes': 0.22; 'paul': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'wrote': 0.26; 'values': 0.26; 'guess': 0.27; "i'm": 0.29; 'function': 0.30; 'to:addr:python-list': 0.33; 'false': 0.35; 'skip:f 40': 0.35; 'pm,': 0.35; 'author': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'received:62': 0.62; 'from:addr:t': 0.84; 'heh.': 0.84; 'received:62.75': 0.84 Date: Thu, 05 Jul 2012 00:45:38 +0200 From: Thomas Jollans User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: 2 + 2 = 5 References: <7x7guj2u8a.fsf@ruckus.brouhaha.com> In-Reply-To: <7x7guj2u8a.fsf@ruckus.brouhaha.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341441946 news.xs4all.nl 6850 [2001:888:2000:d::a6]:55656 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24877 On 07/04/2012 09:37 PM, 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. > I'm reminded of the swap(a,b) function I wrote a couple of years back. http://blog.jollybox.de/archives/62-python-swap