title: Can we use a python variable to hold an entire file?
body: <p>Provided that we know that all the file will be loaded in memory and we can afford it,
  what are the drawbacks (if any) or limitations (if any) of loading an entire file (possibly a binary file) in a python variable. If this is technically possible, should this be avoided, and why ?</p>
  
  <p>Regarding file size concerns, to what maximum size this solution should be limited ?. And why ?</p>
  
  <p>The actual loading code could be the one proposed in <a href="https://stackoverflow.com/questions/1432126/how-to-get-content-of-a-small-ascii-file-in-python">this stackoverflow entry</a>.</p>
  
  <p>Sample code is:</p>
  
  <pre><code>def file_get_contents(filename):
      with open(filename) as f:
          return f.read()
  
  content = file_get_contents('/bin/kill')
  
  ... code manipulating 'content' ...
  </code></pre>
  
  <p>[EDIT]
  Code manipulation that comes to mind (but is maybe not applicable) is standard list/strings operators (square brackets, '+' signs) or some string operators ('len', 'in' operator, 'count', 'endswith'/'startswith', 'split', 'translation' ...).</p>