__init__ is the initialiser

Roy Smith roy at panix.com
Sun Feb 2 18:40:59 EST 2014


In article <mailman.6313.1391383680.18130.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> What you see here is proof that Python really does need an explicit
> destroy() function. It would need to recycle the object [1], forcing
> all references to it to dangle:
> 
> >>> a = object()
> >>> b = a
> >>> destroy(a)
> >>> c = b
> 
> Traceback (most recent call last):
>   File "<pyshell#89>", line 1, in <module>
>     c = b
> SegmentationError: dereferencing a dangling pointer
> 
> It's a serious lack in Python. Currently it's not possible to do this
> without fiddling around in ctypes.
> 
> ChrisA
> 
> [1] Scrub the RAM clean and return it to the computer, put the 1 bits
> onto the stack for subsequent reuse, and throw all the useless 0 bits
> out onto the heap.

I'm reasonably sure you posted this as humor, but there is some truth in 
what you said.  In the crypto/security domain, you often want to keep a 
key or cleartext around only for the time it's needed, and scrub the 
memory it was occupying as soon as it is no longer in use.

I don't know how you would do that in Python.



More information about the Python-list mailing list