Kaydet (Commit) f9607821 authored tarafından Fred Drake's avatar Fred Drake

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.
üst 551d2b14
...@@ -555,7 +555,12 @@ class Wave_write: ...@@ -555,7 +555,12 @@ class Wave_write:
self._file.seek(curpos, 0) self._file.seek(curpos, 0)
self._datalength = self._datawritten 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'): if mode in ('r', 'rb'):
return Wave_read(f) return Wave_read(f)
elif mode in ('w', 'wb'): elif mode in ('w', 'wb'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment