On 2017-11-07, Chris Angelico <ros...@gmail.com> wrote:
> On Wed, Nov 8, 2017 at 6:44 AM, Stefan Ram <r...@zedat.fu-berlin.de> wrote:
>> Chris Angelico <ros...@gmail.com> writes:
>>>sure what your point is. None, False, and True are all keywords, not
>>>built-ins, so you can't assign to them (any more than you could assign
>>>to a literal integer).
>>
>> |Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit 
>> (AMD64)] on win32
>> |Type "help", "copyright", "credits" or "license" for more information.
>> |>>>
>> |>>> import ctypes
>> |>>>
>> |>>> value = 2
>> |>>> ob_ival_offset = ctypes.sizeof(ctypes.c_size_t) + 
>> ctypes.sizeof(ctypes.c_voidp)
>> |>>> ob_ival = ctypes.c_int.from_address(id(value)+ob_ival_offset)
>> |>>> ob_ival.value = 3
>> |>>>
>> |>>> print 2
>> |3
>
> That's still not assigning to a literal; that's mutating a cached
> object. There's a difference :)

True.

> Also, once you start messing with ctypes like this, all language
> guarantees are out the window.

In FORTRAN, the only language gurantees were

 1) When running your program, you'd almost, but not always, get all
    of your cards back.

 2) The probability (P) of finding an available IBM 29 cardpunch was
    approximately D**2 where D is how many day's you had left before
    your deadline: with one hour left, P = 1/(24*24).

-- 
Grant Edwards grant.b.edwards Yow! LOOK!!  Sullen at American teens
                                  wearing gmail.com MADRAS shorts and
                                  "Flock of Seagulls" HAIRCUTS!

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to