Re: Abstract Methods & Abstract Class

Discussion in 'Python' started by Gerald Klix, Oct 20, 2005.

  1. Gerald Klix

    Gerald Klix Guest

    Isn't

    class AbstractBase:
    def method(self):
    raise NotImplementedError( "abstract method called" )

    the right thing to do?

    Gerald

    ----- Original Message -----
    From: "Andreas Kostyrka" <>
    To: "Iyer, Prasad C" <>
    Cc: <>
    Sent: Thursday, October 20, 2005 8:56 AM
    Subject: Re: Abstract Methods & Abstract Class


    > On Thu, Oct 20, 2005 at 12:05:05PM +0530, Iyer, Prasad C wrote:
    > >
    > > Do we have something like abstract methods & Abstract class.
    > >
    > > So that my class would just define the method. And the implementation
    > > would be defined by somebody else.

    >
    > class AbstractBase:
    > def method(self):
    > raise TypeError("abstract method called")
    >
    > But basically, Python does not have abstract methods, and usually doesn't
    > need them.
    >
    > Andreas
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    Gerald Klix, Oct 20, 2005
    #1
    1. Advertising

  2. or

    [...]
    def method(self):
    assert not "must be overrided"
    =?iso-8859-1?B?c+liYXN0aWVu?=, Oct 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DaKoadMunky
    Replies:
    4
    Views:
    537
    Lee Weiner
    Apr 20, 2004
  2. Matthias Kaeppler
    Replies:
    1
    Views:
    416
    R.F. Pels
    May 22, 2005
  3. Iyer, Prasad C

    Abstract Methods & Abstract Class

    Iyer, Prasad C, Oct 20, 2005, in forum: Python
    Replies:
    0
    Views:
    525
    Iyer, Prasad C
    Oct 20, 2005
  4. Replies:
    4
    Views:
    798
    Rolf Magnus
    May 17, 2006
  5. Kenneth McDonald
    Replies:
    5
    Views:
    297
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page