On Tue, 19 Mar 2013 21:44:15 -0700 Michael Foord <fuzzyman at voidspace.org.uk> wrote: > > mock_open makes it easy to put a StringIO in place if that's what you want. It's just a simple helper function for providing some known data *along with the Mock api* to make asserts that it was used correctly. It isn't presenting a full file-system. My suggestion to the implementor of the patch was that read / readline / readlines be disconnected - but the patch provided allows them to be interleaved and I saw no reason to undo that. > > If users want more complex behaviour (like universal newline support) they can use mock_open along with a StringIO. This is not about complex behaviour but simply correct behaviour. For the record, universal newlines are enabled by default in Python 3: >>> with open("foo", "wb") as f: f.write(b"a\r\nb\rc\n") ... 7 >>> with open("foo", "r") as f: print(list(f)) ... ['a\n', 'b\n', 'c\n'] Regards Antoine.
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