Manish Sinha wrote:
> Filip Gruszczyński wrote:
>> I am trying to delete a method from a class. It's easy to delete other
>> attributes, but when I try:
>>
>>
> class A:
>
>> ... def foo():
>> ... pass
>> ...
>>
> a = A()
> del a.foo
>
>>
HAHAHAHA, I like your sig Ben. So much that I blogged about it.
starnixalpha.blogspot.com
Oh yeah, and the info on this thread was helpful.
Thanks, -A
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
On Sun, Ja
"Filip Gruszczyński" writes:
> 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?
Rather than “how object creation is performed”, I would recommend
you get a better handle on how the object *mod
Filip Gruszczyński wrote:
I am trying to delete a method from a class. It's easy to delete other
attributes, but when I try:
class A:
... def foo():
... pass
...
a = A()
del a.foo
I get
Traceback (most recent call last):
File "", line 1, in
Attrib
> 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'
MRAB writes:
> Filip Gruszczyński wrote:
> > Traceback (most recent call last):
> > File "", line 1, in
> > AttributeError: A instance has no attribute 'foo'
> >
> > Why is it so and how may still delete it?
> >
> 'a' is an instance of class A. You're trying to delete 'foo' from
> the instance
Filip Gruszczyński wrote:
I am trying to delete a method from a class. It's easy to delete other
attributes, but when I try:
class A:
... def foo():
... pass
...
a = A()
del a.foo
I get
Traceback (most recent call last):
File "", line 1, in
AttributeError: A instance has
I am trying to delete a method from a class. It's easy to delete other
attributes, but when I try:
>>> class A:
... def foo():
... pass
...
>>> a = A()
>>> del a.foo
I get
Traceback (most recent call last):
File "", line 1, in
AttributeError: A instance has no attribute 'foo'