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


Groups > comp.lang.python > #24888 > unrolled thread

Re: 2 + 2 = 5

Started byEvan Driscoll <driscoll@cs.wisc.edu>
First post2012-07-04 19:39 -0500
Last post2012-07-04 19:39 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: 2 + 2 = 5 Evan Driscoll <driscoll@cs.wisc.edu> - 2012-07-04 19:39 -0500

#24888 — Re: 2 + 2 = 5

FromEvan Driscoll <driscoll@cs.wisc.edu>
Date2012-07-04 19:39 -0500
SubjectRe: 2 + 2 = 5
Message-ID<mailman.1804.1341448814.4697.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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.

Evan


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web