def enum_heads(): for segment in enum_segments(): for head in idautils.Heads(segment.start, segment.end): yield head