Abstract class

Larry Bates larry.bates at vitalEsafe.com
Sun Sep 14 12:49:08 EDT 2008


Mr.SpOOn wrote:
> Hi,
> I'm going to work on a project to represent some musical theory in
> Python, in an object oriented way.
> 
> I have to manage many elements of music such as notes, intervals,
> scales, chords and so on. All these elements share properties and
> behavior, so what I want to do is an abstract class "Note" and other
> subclasses, for example "NaturalNote", "FlatNote", "SharpNote" etc.
> 
> The idea is not original, I read it in some papers where they talk
> about an implementation in smalltalk.
> 
> I want to use Python (of course) and I'd like to know what is the
> practice in such a case. I mean, in python there aren't abstract
> classes, but I read about some way to emulate the same behavior.
> 
> What do you suggest me?
> 
> Thanks,
> Carlo

I think the issue is one of terminology not features.  Note would be a base 
class and it can have attributes (properties) and behavior (methods). 
NaturalNote, FlatNote, SharpNote would inherit from Note.

-Larry



More information about the Python-list mailing list