FAQ

Le vendredi 08 septembre 2006 09:51, bearophileHUGS at lycos.com a ?crit?:
Frank Millman, just a short note, more expert people can give you
better answers. There aren't abstract classes in Python. They are all
concrete.
Really ? This is like saying there is no singleton in Python...

class AbstractClass(object) :

def __init__(self) : raise RuntimeError('Ths class is an abstract one !')

The abstract class can then define APIs (methods which raise
NotImplementedError) and/or logic (fully implemented methods).
With this scheme you are not stuck to the "API only" usage of abstract classes
like in Java nad its interfaces.
You may have classes with undefined methods (they may raise
NotImplementedError).
C++ "pure virtual methods" is only the C++ way of doing something which is a
more general concept in OOP.


--
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 8 of 13 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedSep 8, '06 at 7:03a
activeSep 9, '06 at 6:24p
posts13
users6
websitepython.org

People

Translate

site design / logo © 2022 Grokbase