Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72091

Re: confused about the different built-in functions in Python

From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: confused about the different built-in functions in Python
Date 2014-05-27 11:14 +1200
Message-ID <bui06sFbst8U1@mid.individual.net> (permalink)
References (2 earlier) <mailman.10353.1401130279.18130.python-list@python.org> <87r43gfjqy.fsf@elektro.pacujo.net> <mailman.10356.1401133664.18130.python-list@python.org> <87ioosffh3.fsf@elektro.pacujo.net> <87egzgfe9u.fsf@elektro.pacujo.net>

Show all headers | View raw


Marko Rauhamaa wrote:

> IOW, you can override a method with setattr() but you cannot delete a
> method with delattr().

Actually, you can -- but you need to delete it from
the class, not the instance:

 >>> delattr(X, 'f')
 >>> x.f()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
AttributeError: 'X' object has no attribute 'f'

-- 
Greg

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: confused about the different built-in functions in Python Terry Reedy <tjreedy@udel.edu> - 2014-05-26 14:51 -0400
  Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 22:00 +0300
    Re: confused about the different built-in functions in Python Christian Heimes <christian@python.org> - 2014-05-26 21:47 +0200
      Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 23:32 +0300
        Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 23:58 +0300
          Re: confused about the different built-in functions in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-05-27 11:14 +1200
          Re: confused about the different built-in functions in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-27 01:21 +0000
        Re: confused about the different built-in functions in Python Terry Reedy <tjreedy@udel.edu> - 2014-05-26 22:00 -0400

csiph-web