Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2943)

Side by Side Diff: Lib/_pyio.py

Issue 12760: Add create mode to open()
Patch Set: Created 1 year, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/whatsnew/3.3.rst ('k') | Modules/_io/fileio.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 Python implementation of the io module. 2 Python implementation of the io module.
3 """ 3 """
4 4
5 import os 5 import os
6 import abc 6 import abc
7 import codecs 7 import codecs
8 import warnings 8 import warnings
9 import errno 9 import errno
10 # Import _thread instead of threading to reduce startup cost 10 # Import _thread instead of threading to reduce startup cost
(...skipping 23 matching lines...) Expand all
34 34
35 file is either a text or byte string giving the name (and the path 35 file is either a text or byte string giving the name (and the path
36 if the file isn't in the current working directory) of the file to 36 if the file isn't in the current working directory) of the file to
37 be opened or an integer file descriptor of the file to be 37 be opened or an integer file descriptor of the file to be
38 wrapped. (If a file descriptor is given, it is closed when the 38 wrapped. (If a file descriptor is given, it is closed when the
39 returned I/O object is closed, unless closefd is set to False.) 39 returned I/O object is closed, unless closefd is set to False.)
40 40
41 mode is an optional string that specifies the mode in which the file is 41 mode is an optional string that specifies the mode in which the file is
42 opened. It defaults to 'r' which means open for reading in text mode. Other 42 opened. It defaults to 'r' which means open for reading in text mode. Other
43 common values are 'w' for writing (truncating the file if it already 43 common values are 'w' for writing (truncating the file if it already
44 exists), 'x' for creating and writing to a new file, and 'a' for appending 44 exists), 'x' for exclusive creation of a new file, and 'a' for appending
45 (which on some Unix systems, means that all writes append to the end of the 45 (which on some Unix systems, means that all writes append to the end of the
46 file regardless of the current seek position). In text mode, if encoding is 46 file regardless of the current seek position). In text mode, if encoding is
47 not specified the encoding used is platform dependent. (For reading and 47 not specified the encoding used is platform dependent. (For reading and
48 writing raw bytes use binary mode and leave encoding unspecified.) The 48 writing raw bytes use binary mode and leave encoding unspecified.) The
49 available modes are: 49 available modes are:
50 50
51 ========= =============================================================== 51 ========= ===============================================================
52 Character Meaning 52 Character Meaning
53 --------- --------------------------------------------------------------- 53 --------- ---------------------------------------------------------------
54 'r' open for reading (default) 54 'r' open for reading (default)
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 def errors(self): 2065 def errors(self):
2066 return None 2066 return None
2067 2067
2068 @property 2068 @property
2069 def encoding(self): 2069 def encoding(self):
2070 return None 2070 return None
2071 2071
2072 def detach(self): 2072 def detach(self):
2073 # This doesn't make sense on StringIO. 2073 # This doesn't make sense on StringIO.
2074 self._unsupported("detach") 2074 self._unsupported("detach")
OLDNEW
« no previous file with comments | « Doc/whatsnew/3.3.rst ('k') | Modules/_io/fileio.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7