This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mode 't' not documented as posssible mode for file built-in
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, georg.brandl, ssalmine, tim.peters
Priority: normal Keywords:

Created on 2005-12-15 15:37 by ssalmine, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg27080 - (view) Author: Simo Salminen (ssalmine) Date: 2005-12-15 15:37
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).
msg27081 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-12-15 16:08
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.
msg27082 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-12-15 21:36
Logged In: YES 
user_id=1188172

I removed the reference to "t" from the docs of file.seek()
in rev 41703,41704.
msg27083 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-07-30 11:11
Logged In: YES 
user_id=849994

I believe there's nothing more to do here.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42697
2005-12-15 15:37:33ssalminecreate