Mark Summerfield wrote: > Hi, > > I was wondering if it is yet known what the right way to open text files > in P3K will be? > > According to the docs the signature for open() is: > > open(filename[, mode[, bufsize]])
The docs must be outdated. open() accepts more arguments: open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True) > Is that going to stay the same and default to UTF-8 if "b" is not in the > mode (or if no mode is specified) and bytes if "b" is present? The new IO library is using UTF-8 as default encoding for text mode unless a different encoding is given. The open() function and the IO streams are much closer to the codecs package. help(open) isn't very helpful in 3.0a2 and earlier. I fixed the doc string shortly after the release. import io; help(io.open) gives you the real open function. Please note that the IO library is mostly written in Python, see Lib/io.py Christian _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
