title: Defining variables efficiently according to a parameter that may take several values
body: <p>I have this function that defines and returns variables <code>a</code> and <code>b</code> depending on the value of the parameter <code>orientation</code>. </p>
  
  <pre><code>        def myfunc(orientation, l, w):
  
  
              if orientation == 1:
                  a = -w
                  b = l
              elif orientation == 2:
                  a = -l
                  b = w
              elif orientation == 3:
                  a = -w
                  b = -l
              elif orientation == 4:
                  a = -l
                  b = -w
              elif orientation == 5:
                  a = w
                  b = l
              elif orientation == 6:
                  a = l
                  b = w
              elif orientation == 7:
                  a = w
                  b = -l
              elif orientation == 8:
                  a = l
                  b = -w
  
              return a, b
  </code></pre>
  
  <p>My question is: is there a more compact and/or more efficient way to do the same thing? and if there is a better way, which is it? </p>