[BangPypers] how to delete base class attribute

Nitin Kumar nitin.nitp at gmail.com
Thu Jul 29 10:48:02 CEST 2010


Hi all,



Say I have 10 functions in base class and I have inherited it in some
derived class.

But I only want 9 of the base class function to be available in child class.
(and I don’t want to make that one class private)



class x:

    def __init__(self):

        self.a =3

        self.b= 4

    def A(self):

        print (self.a)

    def B(self):

        print (self.b)



class y(x):

    def __init__(self):

        x.__init__(self)

        del (self.A)                                  #This is giving    del
(self.A)

AttributeError: A





Anticipating your reply soon.

-- 
Nitin K


More information about the BangPypers mailing list