summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-06-17 15:18:47 (GMT)
committerFred Drake <fdrake@acm.org>1999-06-17 15:18:47 (GMT)
commitf9607821ade54ec75d8d91952b64ecf1bfde4923 (patch)
tree129dbb8543950c281d69c9e165841db873b275be /Lib
parent551d2b14e76943a2a4a4bfe60dae9139635f3b0a (diff)
downloadcpython-f9607821ade54ec75d8d91952b64ecf1bfde4923.zip
cpython-f9607821ade54ec75d8d91952b64ecf1bfde4923.tar.gz
cpython-f9607821ade54ec75d8d91952b64ecf1bfde4923.tar.bz2
open(): Make the mode parameter optional; if omitted or None, use the
mode attribute of the file object (if it has one), otherwise use 'rb'. The documentation should still show this as required until there's a new release.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/wave.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/wave.py b/Lib/wave.py
index 1353b51..5344db2 100644
--- a/Lib/wave.py
+++ b/Lib/wave.py
@@ -555,7 +555,12 @@ class Wave_write:
self._file.seek(curpos, 0)
self._datalength = self._datawritten
-def open(f, mode):
+def open(f, mode=None):
+ if mode is None:
+ if hasattr(f, 'mode'):
+ mode = f.mode
+ else:
+ mode = 'rb'
if mode in ('r', 'rb'):
return Wave_read(f)
elif mode in ('w', 'wb'):