I'm writing a program where I need to iterate through all the lines of a file. Pretty standard stuff. My concern is that because I want to strip the new line character from each line, I'm doing something like this:

```
for line in map(lambda s: s.strip("\n"), file_input.readlines()):
    do_something(line)

```

Does Python evaluate each time the value `map(lambda s: s.strip("\n"), file_input.readlines())`? My gut feeling is that Python is smarter than this, but any confirmation and/or reference would be very helpful to me!

---

I'm also assuming that the answer would also apply to list comprehension, for something like:

```
results = [x for x in list(set(self.database.values())) if x.startswith(text)]

```

where I hope it is not calculating `list(set(self.database.values()))` multiple times.