[Python-de] Re: for unpacking
[email protected] (Stefan Ram) 6 Aug 2024 21:42:00 GMT
| Newsgroups | gmane.comp.python.general.german |
|---|---|
| Organization | Stefan Ram |
| Message-ID | <[email protected]> |
[email protected] (Stefan Ram) schrieb oder zitierte: >1 In einigen Python-Implementationen kann man es durch einen > Trick erreichen, daß "print( 2 )" zur Ausgabe von "3" führt, > aber das ist wohl nicht portabel und würde bei normaler > Programmierung nicht verwendet werden. Unter der Standardimplementation von Python: import ctypes j = 3 def deref( addr, typ ): return ctypes.cast( addr, ctypes.POINTER( typ )) deref( id( 2 ), ctypes.c_int )[ 6 ]= j print( 2 ) . _______________________________________________ python-de Mailingliste -- [email protected] Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an [email protected] https://mail.python.org/mailman3/lists/python-de.python.org/ Mitgliedsadresse: [email protected]