[Python] Python object deleting itself

Discussão em 'Python' iniciado por Stack, Dezembro 7, 2024.

  1. Stack

    Stack Membro Participativo

    Why won't this work? I'm trying to make an instance of a class delete itself.

    >>> class A():
    def kill(self):
    del self


    >>> a = A()
    >>> a.kill()
    >>> a
    <__main__.A instance at 0x01F23170>

    Continue reading...

Compartilhe esta Página