On Feb 26, 2004, at 8:13 PM, Raymond Hettinger wrote: >> This is a big YES! > > Actually, it's a big no. Alex, immediately and correctly pointed out > that what is needed in a suffix rather than a separator and the way to > get that is with a generator expression: f.writelines(x+'\n' for x in > mylines). That'll still cause the copying of every string in the iterable; interleaving the newline with the strings themselves would probably be a faster solution, I think. > I had been led astray because I was experimenting with using > cStringIO.writelines() as a basis for implementing str.join() for > general iterables without creating an intermediate tuple. Right now, > ''.join(it) will unexpectedly consume much more memory than really > needed. This sounds like a cool idea, are you still going to implement it? Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4