On Friday, July 6, 2012 8:39:58 AM UTC+10, Andrew Cooper wrote:
On 05/07/2012 22:46, Evan Driscoll wrote:
gt; On 01/-10/-28163 01:59 PM, Alexander Blinne wrote:
gt;gt; 5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4.
gt;gt; 5+1 is actually 4+1, which is 5, but 5 is again 4.
gt;gt; 5+2 is
On 5/07/12 07:32:48, Steven D'Aprano wrote:
On Wed, 04 Jul 2012 23:38:17 -0400, Terry Reedy wrote:
If I run the script in 3.3 Idle, I get the same output you got. If I
then enter '5-2' interactively, I still get 3. Maybe the constant folder
is always on now.
Yes, I believe constant
On 2012-07-04 21: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
== 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.
five.contents[five.contents[:].index(5)] = 4
5
4
5 is 4
True
But this I don't
On Thu, Jul 5, 2012 at 10:34 AM, Laszlo Nagy gand...@shopzeus.com wrote:
5+1
4
4 + 1 is 5 is 4.
(e.g. try 2+3 as well).
-- Devin
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 05 Jul 2012 15:57:53 +0200, Hans Mulder wrote:
On 5/07/12 07:32:48, Steven D'Aprano wrote:
On Wed, 04 Jul 2012 23:38:17 -0400, Terry Reedy wrote:
If I run the script in 3.3 Idle, I get the same output you got. If I
then enter '5-2' interactively, I still get 3. Maybe the constant
On 05.07.2012 16:34, Laszlo Nagy wrote:
five.contents[five.contents[:].index(5)] = 4
5
4
5 is 4
True
That's surprising, because even after changing 5 to 4 both objects still
have different id()s (tested on Py2.7), so 5 is 4 /should/ still be
False (But isn't on my 2.7). But that's some
On 5/07/12 19:03:57, Alexander Blinne wrote:
On 05.07.2012 16:34, Laszlo Nagy wrote:
five.contents[five.contents[:].index(5)] = 4
5
4
5 is 4
True
That's surprising, because even after changing 5 to 4 both objects still
have different id()s (tested on Py2.7), so 5 is 4 /should/ still be
On 01/-10/-28163 01:59 PM, Alexander Blinne wrote:
5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4.
5+1 is actually 4+1, which is 5, but 5 is again 4.
5+2 is 4+2 which is 6.
Now all I can think is Hoory for new math, new-hoo-hoo math :-)
Evan
--
On Wed, 04 Jul 2012 20:37:25 +0100, Paul Rubin phr-2...@nightsong.com
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
On 05/07/2012 22:46, Evan Driscoll wrote:
On 01/-10/-28163 01:59 PM, Alexander Blinne wrote:
5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4.
5+1 is actually 4+1, which is 5, but 5 is again 4.
5+2 is 4+2 which is 6.
Now all I can think is Hoory for new math, new-hoo-hoo math :-)
Evan
On Thu, 05 Jul 2012 16:46:48 -0500, Evan Driscoll wrote:
On 01/-10/-28163 01:59 PM, Alexander Blinne wrote:
5+0 is actually 4+0, because 5 == 4, so 5+0 gives 4. 5+1 is actually
4+1, which is 5, but 5 is again 4. 5+2 is 4+2 which is 6.
Now all I can think is Hoory for new math, new-hoo-hoo
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
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
Am 04.07.2012, 21:37 Uhr, schrieb Paul Rubin phr-2...@nightsong.com:
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
On 04/07/2012 20: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
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
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
(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
), 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.
Neat.
Playing with it, i'm wondering:
This:
import
On Wed, 04 Jul 2012 23:38:17 -0400, Terry Reedy wrote:
If I run the script in 3.3 Idle, I get the same output you got. If I
then enter '5-2' interactively, I still get 3. Maybe the constant folder
is always on now.
Yes, I believe constant folding is always on, since Python 2.4 if I
remember
21 matches
Mail list logo