Discussion:
[Python-3000-checkins] r66830 - in python/branches/py3k/Doc/library: functions.rst os.path.rst os.rst
martin.v.loewis
2008-10-07 07:03:04 UTC
Permalink
Author: martin.v.loewis
Date: Tue Oct 7 09:03:04 2008
New Revision: 66830

Log:
More bytes vs. strings documentation.


Modified:
python/branches/py3k/Doc/library/functions.rst
python/branches/py3k/Doc/library/os.path.rst
python/branches/py3k/Doc/library/os.rst

Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst (original)
+++ python/branches/py3k/Doc/library/functions.rst Tue Oct 7 09:03:04 2008
@@ -710,10 +710,11 @@

Open a file. If the file cannot be opened, :exc:`IOError` is raised.

- *file* is either a string giving the name (and the path if the file isn't in
- the current working directory) of the file to be opened or an integer file
- descriptor of the file to be wrapped. (If a file descriptor is given, it is
- closed when the returned I/O object is closed, unless *closefd* is set to
+ *file* is either a string or bytes object giving the name (and the
+ path if the file isn't in the current working directory) of the
+ file to be opened or an integer file descriptor of the file to be
+ wrapped. (If a file descriptor is given, it is closed when the
+ returned I/O object is closed, unless *closefd* is set to
``False``.)

*mode* is an optional string that specifies the mode in which the file is

Modified: python/branches/py3k/Doc/library/os.path.rst
==============================================================================
--- python/branches/py3k/Doc/library/os.path.rst (original)
+++ python/branches/py3k/Doc/library/os.path.rst Tue Oct 7 09:03:04 2008
@@ -10,7 +10,14 @@

This module implements some useful functions on pathnames. To read or
write files see :func:`open`, and for accessing the filesystem see the
-:mod:`os` module.
+:mod:`os` module. The path parameters can be passed as either strings,
+or bytes. Applications are encouraged to represent file names as
+(Unicode) character strings. Unfortunately, some file names may not be
+representable as strings on Unix, so applications that need to support
+arbitrary file names on Unix should use bytes objects to represent
+path names. Vice versa, using bytes objects cannot represent all file
+names on Windows (in the standard ``mbcs`` encoding), hence Windows
+applications should use string objects to access all files.

.. warning::


Modified: python/branches/py3k/Doc/library/os.rst
==============================================================================
--- python/branches/py3k/Doc/library/os.rst (original)
+++ python/branches/py3k/Doc/library/os.rst Tue Oct 7 09:03:04 2008
@@ -694,6 +694,8 @@
.. function:: getcwd()

Return a string representing the current working directory.
+ May raise UnicodeDecodeError if the current directory path fails
+ to decode in the file system encoding.
Availability: Unix, Windows.

Loading...