Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'explicitly': 0.05; 'output': 0.05; 'subject:Python': 0.06; '"""': 0.07; 'explicit': 0.07; 'lines,': 0.07; 'purpose.': 0.07; 'subject:file': 0.07; 'append': 0.09; 'convention,': 0.09; 'if,': 0.09; 'newline': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'trailing': 0.09; 'language.': 0.14; '(other': 0.16; 'both,': 0.16; 'implies': 0.16; 'inputs': 0.16; 'length,': 0.16; 'length.': 0.16; 'lengths': 0.16; 'message- id:@4ax.com': 0.16; 'newlines': 0.16; 'outputs': 0.16; 'preceded': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simpson': 0.16; 'subject:Reading': 0.16; 'subject:log': 0.16; 'subprograms': 0.16; 'terminator': 0.16; 'followed': 0.16; 'language': 0.16; 'file,': 0.19; 'value.': 0.19; 'fit': 0.20; 'input': 0.22; 'pages,': 0.22; 'logical': 0.24; 'url:home': 0.24; 'file.': 0.24; '(or': 0.24; 'recognized': 0.26; 'certain': 0.27; 'defined': 0.27; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'point': 0.28; 'characters': 0.30; 'mode': 0.30; 'nature': 0.30; 'operations,': 0.30; 'specified': 0.30; "i'm": 0.30; 'concern': 0.31; 'constant': 0.31; 'horizontal': 0.31; 'file': 0.32; 'supposed': 0.32; 'text': 0.33; 'implemented': 0.33; 'actual': 0.34; 'subject: (': 0.35; 'combination': 0.36; 'sequence': 0.36; 'view,': 0.36; 'charset:us-ascii': 0.36; 'example,': 0.37; 'received:76': 0.38; 'depends': 0.38; 'ends': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'even': 0.60; 'consists': 0.60; 'free': 0.61; 'length': 0.61; 'new': 0.61; 'entire': 0.61; 'complete': 0.62; 'maximum': 0.63; 'more': 0.64; 'determine': 0.67; 'mar': 0.68; 'line,': 0.68; 'further,': 0.74; 'introduce': 0.78; '(11)': 0.84; 'bounded': 0.84; 'follow,': 0.84; 'package?': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Reading in cooked mode (was Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary) Date: Sun, 23 Mar 2014 10:37:04 -0400 Organization: IISS Elusive Unicorn References: <20140323021635.GA90771@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-26-115.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 71 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395585437 news.xs4all.nl 2911 [2001:888:2000:d::a6]:48050 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68809 On Sun, 23 Mar 2014 13:16:35 +1100, Cameron Simpson declaimed the following: >As far as I'm concerned, a text file is a sequence lines, each of >which is _terminated_ by a newline (or the OS end-of-line flavour). > May I introduce you to Ada and the Text_IO package? http://www.adahome.com/rm95/rm9x-A-10.html """ (7) From a logical point of view, a text file is a sequence of pages, a page is a sequence of lines, and a line is a sequence of characters; the end of a line is marked by a line terminator; the end of a page is marked by the combination of a line terminator immediately followed by a page terminator; and the end of a file is marked by the combination of a line terminator immediately followed by a page terminator and then a file terminator. Terminators are generated during output; either by calls of procedures provided expressly for that purpose; or implicitly as part of other operations, for example, when a bounded line length, a bounded page length, or both, have been specified for a file. (8) The actual nature of terminators is not defined by the language and hence depends on the implementation. Although terminators are recognized or generated by certain of the procedures that follow, they are not necessarily implemented as characters or as sequences of characters. Whether they are characters (and if so which ones) in any particular implementation need not concern a user who neither explicitly outputs nor explicitly inputs control characters. The effect of input (Get) or output (Put) of control characters (other than horizontal tabulation) is not specified by the language. """ and """ (11) For an output file or an append file, a maximum line length can be specified and a maximum page length can be specified. If a value to be output cannot fit on the current line, for a specified maximum line length, then a new line is automatically started before the value is output; if, further, this new line cannot fit on the current page, for a specified maximum page length, then a new page is automatically started before the value is output. Functions are provided to determine the maximum line length and the maximum page length. When a file is opened with mode Out_File or Append_File, both values are zero: by convention, this means that the line lengths and page lengths are unbounded. (Consequently, output consists of a single line if the subprograms for explicit control of line and page structure are not used.) The constant Unbounded is provided for this purpose. """ In particular, point (8). The implementation is free to use a form where each "line" is preceded by a length value. Might be more complicated to handle in piecemeal I/O as the entire "line" needs to be buffered until complete and a length is known. > >Plenty of people use editors that consider end-of-line to be a >separator and not a terminator, leading to supposed text files >lacking trailing newlines (or end-of-line of OS). > Also note that point (7) implies that even if one is using control-characters as terminators, a valid text file ends with What does that do to your editor? -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/