◐ Shell
clean mode source ↗

Message 121051 - Python tracker

>What is the best way to pass around source code?
> - file-like objects, line iterators, readline-like function?

Line iterator (list of lines) as returned by open().readlines.
Memory should not be an issue. Read disk once and close.

with open('file', ...) as f:
  src = f.readlines()