Frank Millman wrote:
Bruno Desthuilliers wrote:
I have not gone to the trouble of raising NotImplementedError - the
methods that the subclasses *must* override just have a 'pass'
statement. I guess it would be more correct to raise the error, as it
would give me a quicker indication of an error if I happened to omit
one, but in practice I would find out pretty quickly anyway.
Bruno Desthuilliers wrote:
Frank Millman wrote:
It would not make sense, no.bearophileHUGS at lycos.com wrote:
(snip)There aren't abstract classes in Python. They are all
concrete.
concrete.
I use the term 'abstract class' in the abstract sense :-)
Say I have three classes where 90% of the attributes and methods are
common. It makes sense to create a base class with these attributes and
methods, and turn each of the three classes into a subclass which
inherits from the base class and overrides the bits that are unique to
each one.
This is what I call an abstract class. Maybe there is a more correct
term.
Depends if instanciating this base class would make any sense.Say I have three classes where 90% of the attributes and methods are
common. It makes sense to create a base class with these attributes and
methods, and turn each of the three classes into a subclass which
inherits from the base class and overrides the bits that are unique to
each one.
This is what I call an abstract class. Maybe there is a more correct
term.
I have not gone to the trouble of raising NotImplementedError - the
methods that the subclasses *must* override just have a 'pass'
statement. I guess it would be more correct to raise the error, as it
would give me a quicker indication of an error if I happened to omit
one, but in practice I would find out pretty quickly anyway.
better raising NotImplementedError. Makes things more obvious IMHO.
Now there are of course methods that are only provided as hooks - here
it's ok to have some no-op default behaviour.
My 2 cents
Frank
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"