Why is “slurping” a file not a good practice?

Again and again we see questions asking about reading a text file to process it line-by-line, that use variations of read, or readlines, which pull the entire file into memory in one action. The documentation for read says: Opens the file, optionally seeks to the given offset, then returns length bytes (defaulting to the rest … Read more