Abstract class

Christian Heimes lists at cheimes.de
Sun Sep 14 20:19:17 CEST 2008


Roy Smith wrote:
>Are you also going to have DoubleSharpNote and DoubleFlatNote?
> 
> Consider the following code:
> 
> note1 = SharpNote("E4")
> note2 = NaturalNote("F4")
> if note1 == note2:
>    print "the same note"
> else
>    print "different notes"
> 
> what should it print?

Hehe, tricky question.

The answer depends on the music instrument and tuning. On a piano E# and 
F are on the same key but other instruments (e.g. a violin) treat E# and 
F as different notes. The enharmonic equivalent E# == F is only valid 
for some instruments and tunes - noticeable for modern tunes like equal 
temperament.

Christian




More information about the Python-list mailing list