title: Class with constants and methods
body: <p>I'm writing a python module, and it is supposed to contain some constants, which I'm currently grouping in a class, like so:</p>
  
  <pre><code>(myModule.py)
  
  class Colors:
      PURPLE = (0.549,0.110,0.706)
      GREEN = (0.188,0.463,0.165)
      BLUE = (0.125,0.247,0.600)
      ORANGE = (0.961,0.533,0.114)
  </code></pre>
  
  <p>So that, in my main program, I can use</p>
  
  <pre><code>(mainProgram.py)
  
  import myModule as mm
  niceColor = mm.Colors.PURPLE
  </code></pre>
  
  <p>So far, so good.</p>
  
  <p>Now, I'd like to add a method to all the constant members of this class, so that I can call them like so:</p>
  
  <pre><code>brightColor = mm.Colors.PURPLE.lighten(0.8)
  darkColor = mm.Colors.PURPLE.darken(0.6)
  </code></pre>
  
  <p>I know how to write the functions <code>lighten</code> and <code>darken</code>, but I'm in the dark as to where to add them to get the wanted functionality. </p>
  
  <p>Many thanks</p>