Re: deleting a method

2009-01-04 Thread Steve Holden
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 > >>

Re: deleting a method

2009-01-04 Thread alex goretoy
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

Re: deleting a method

2009-01-04 Thread Ben Finney
"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

Re: deleting a method

2009-01-04 Thread Manish Sinha
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

Re: deleting a method

2009-01-04 Thread Filip Gruszczyński
> 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'

Re: deleting a method

2009-01-03 Thread Ben Finney
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

Re: deleting a method

2009-01-03 Thread MRAB
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

deleting a method

2009-01-03 Thread Filip Gruszczyński
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'