title: Read 3 of every 4 bytes from file into bytearray
body: <p>I'm new to python. I'm currently reading the contents of a file into a bytearray like so:</p>
  
  <pre><code>self.palette = bytearray(fp.read(paletteSize*4))
  </code></pre>
  
  <p>Instead of reading all the data, I need to do something like:</p>
  
  <pre><code>palette[0] = fp.read(1)
  palette[1] = fp.read(1)
  palette[2] = fp.read(1)
  fp.read(1) #throw a byte away
  palette[3] = fp.read(1)
  # etc thru paletteSize * 4 bytes, resulting in a size * 3 array
  </code></pre>
  
  <p>Basically, I need to throw away every 4th byte and pack the remaining bytes into an array that is 3/4th the size.</p>
  
  <p>What is the best way to do this that is both best performing and cleanest in code? I know I could do this manually like above with a for loop on a range, but that seems really ugly and involving a lot of memory copies in python rather in native C code.</p>
  
  <p>The reason I ask: this is micropython and the files can be somewhat large (4+ KB), so saving 25% is significant.</p>
  
  <p>Spoiler alert: I am reading the palette part of a bitmap file, which is encoded as four byte tuples of blue, green, red, 0x00 - the 4th byte of every palette entry being useless data.</p>