title: Hex to number algorithm
body: <p>Without using a python builtin, I'd like to write a basic routine to find the numeric value given a hex string. (In other words, I don't want to use <code>int('8c', 16)</code>) -- this is for learning purposes).</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>def hex_to_number(hex_string, num=0):
      number_map = {'0':0,'1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15}
      for char in hex_string:
          num = num &lt;&lt; 4
          num += number_map[char]
      return num
  </code></pre>
  
  <p>Is it possible to to this conversion without the number map at the top or is that necessary to do the hex conversion? If not, how else might an algorithm (or even one-liner) be constructed to do this?</p>