I need to loop until I hit the end of a file-like object, but I\'m not finding an \"obvious way to do it\", which makes me suspect I\'m overlooking something, well, obvious.
I'd go with Tendayi's suggestion re function and iterator for readability:
def read4(): len_name = data.read(4) if len_name: len_name = struct.unpack("