Q:

Is using readlines in Python bad code?

I got downvoted for an answer using file.readlines. The critic said that using readlines is crap code (along with other very rude statements).
Is it so bad?

A:

I assume that the problem was the fact that readlines() loads the whole file into memory, which - theoretically - can be a lot.
A lazy approach (iterating over the file and reading progressively as needed) is indeed better in terms of memory usage. Not sure about efficiency, though.

A:

No, readlines is fine. You just have to remember, that the whole file is stored in memory at one point. 

A:

Well, bad and bad. But it loads the whole file in memory which can be a problem, and there is a much better way:
 for line in file:

That will do the same as
 for line in file.xreadlines():

Which is a version of readlines() that doesn't read the whole file in memory. It also works in Python 3 as an added bonus, while xreadlines() doesn't.
So no matter if it's "bad" or not, there is no reason to use it, like ever. So don't. :)

