On 2017-11-07, 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

I vaguely remember being able to do that in some implementations of
FORTRAN yonks ago:

   subroutine foo(i)
      i = 3
   end subroutine func

   [...]

   foo(2)

   write(*,*) 2

output would be:

3

-- 
Grant Edwards               grant.b.edwards        Yow! If I pull this SWITCH
                                  at               I'll be RITA HAYWORTH!!
                              gmail.com            Or a SCIENTOLOGIST!

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

Reply via email to