deleting a method

Filip Gruszczyński gruszczy at gmail.com
Sun Jan 4 04:43:37 EST 2009


> To answer the second question: since 'foo' is an attribute of the
> class 'A', you can delete the attribute from the class.
>
>    >>> class A(object):
>    ...     def foo(self):
>    ...         pass
>    ...
>    >>> a = A()
>    >>> 'foo' in dir(a)
>    True
>    >>> del A.foo
>    >>> 'foo' in dir(a)
>    False

Thanks, now I see, what happens, but don't exactly know why. Could you
point me to some good explanation how object creation is performed in
Python? I browsed language reference and google, but couldn't find
good explanation.

-- 
Filip Gruszczyński


More information about the Python-list mailing list