Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24872

Re: 2 + 2 = 5

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:github': 0.09; '(must': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'message-id:@dough.gmane.org': 0.16; 'portable,': 0.16; 'reason.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stefan': 0.17; 'import': 0.21; 'ctypes': 0.22; 'paul': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'guess': 0.27; 'header:X-Complaints-To:1': 0.28; 'though.': 0.29; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'false': 0.35; 'skip:f 40': 0.35; 'received:org': 0.36; 'author': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'heh.': 0.84; 'received:arcor-ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: 2 + 2 = 5
Date Wed, 04 Jul 2012 21:53:36 +0200
References <7x7guj2u8a.fsf@ruckus.brouhaha.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host dslb-084-056-061-213.pools.arcor-ip.net
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1
In-Reply-To <7x7guj2u8a.fsf@ruckus.brouhaha.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1796.1341431641.4697.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341431641 news.xs4all.nl 6842 [2001:888:2000:d::a6]:35539
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24872

Show key headers only | View raw


Paul Rubin, 04.07.2012 21:37:
> 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.

That's not portable, though. ;)

Stefan

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 2 + 2 = 5 Stefan Behnel <stefan_ml@behnel.de> - 2012-07-04 21:53 +0200

csiph-web