title: Using ord() to convert letters to ints (Very basic)
body: <p>Python beginner here. Trying to learn by reading code here and there. Came across this in a program designed to open Excel files in python. This function does a simple job--converts an Excel column letter label ('Z', or 'BB', or 'CCC') to an int using ord(). I was understanding just fine until I saw this portion of the conversion code:</p>
  
  <pre><code>if clen == 1:
      return ord(column[0]) - 64
  elif clen == 2:
      return ((1 + (ord(column[0]) - 65)) * 26) + (ord(column[1]) - 64)
  </code></pre>
  
  <p>What is the purpose of <strong>(1 + (ord(column[0]) - 65)</strong> versus just using <strong>(ord(column[0]) - 64)</strong> again. The "1 +" seems redundant. Does this have a purpose?</p>
  
  <p>This is the full function:</p>
  
  <pre><code>def column_index_from_string(column, fast=False):
      """Convert a column letter into a column number (e.g. B -&gt; 2)"""
  
      column = column.upper()
  
      clen = len(column)
  
      if not fast and not all('A' &lt;= char &lt;= 'Z' for char in column):
          msg = 'Column string must contain only characters A-Z: got %s' % column
          raise ColumnStringIndexException(msg)
  
      if clen == 1:
          return ord(column[0]) - 64
      elif clen == 2:
          return ((1 + (ord(column[0]) - 65)) * 26) + (ord(column[1]) - 64)
      elif clen == 3:
          return ((1 + (ord(column[0]) - 65)) * 676) + ((1 + (ord(column[1]) - 65)) * 26) + (ord(column[2]) - 64)
  </code></pre>