I've just noticed that (in 2.3.4) open() seems to accept just about anything after the first character of the mode argument: Python 2.3.4 (#1, Jun 30 2004, 16:47:37) [GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
f = open("DU", "rqwerty")
-- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing@canterbury.ac.nz +--------------------------------------+
[Greg Ewing]
I've just noticed that (in 2.3.4) open() seems to accept just about anything after the first character of the mode argument:
Python 2.3.4 (#1, Jun 30 2004, 16:47:37) [GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
f = open("DU", "rqwerty")
Yes. That's because virtually all C libraries accept just about anything in the mode string, so that code using mode-string extensions specific to other platforms doesn't just blow up. Python passes the mode string on to the platform C, and complains if and only if the platform C complains.
participants (2)
-
Greg Ewing
-
Tim Peters