[ python-Bugs-1381717 ] mode 't' not documented as posssible mode for file built-in
SourceForge.net
noreply at sourceforge.net
Thu Dec 15 22:36:17 CET 2005
Bugs item #1381717, was opened at 2005-12-15 16:37
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1381717&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Simo Salminen (ssalmine)
Assigned to: Nobody/Anonymous (nobody)
Summary: mode 't' not documented as posssible mode for file built-in
Initial Comment:
At http://docs.python.org/lib/built-in-funcs.html,
'file' function parameter 'mode' accepts 't' (for text
mode).
This is not documented. It is mentioned in file object
description
(http://docs.python.org/lib/bltin-file-objects.html).
----------------------------------------------------------------------
>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-12-15 22:36
Message:
Logged In: YES
user_id=1188172
I removed the reference to "t" from the docs of file.seek()
in rev 41703,41704.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2005-12-15 17:08
Message:
Logged In: YES
user_id=31435
This is more involved than you might like. In general,
open(path, mode) passes the mode string to the platform C
library's file-opening function, and using anything other
than standard C mode letters ("w", "b", "r", "a", "+") is
platform-dependent. "t" is not a standard C mode letter, so
whether it has any meaning, and exactly what it means if it
_does_ mean something, depends entirely on the platform C
library.
Using "t" to force text mode is a Microsoft-specific
gimmick, so if "t" is documented at all, it should be
plastered with warnings about its platform-specific nature.
Even on a Microsoft platform, "t" is basically silly: text
mode is the default mode (C defines this) -- it's what you
get if you don't pass "b". The only reason Microsoft
supports "t" is because MS has _another_ non-standard option
to tell its C runtime to use binary mode by default, and if
you use that non-standard option then you also need to use
the non-standard "t" mode letter to force a file to open in
text mode.
In short, the docs should change to spell out what the
standard C modes are, and note that at the cost of
portability you can also pass whichever non-standard mode
extensions your platform happens to support.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1381717&group_id=5470
More information about the Python-bugs-list
mailing list