Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'wed,': 0.03; 'subject:bug': 0.04; 'encoded': 0.05; 'mrab': 0.05; 'subject:Python': 0.06; 'mode,': 0.07; 'undefined': 0.09; 'pm,': 0.10; '25,': 0.12; 'subject:file': 0.14; 'wrote:': 0.14; 'meant': 0.18; 'bytes': 0.19; 'header:In-Reply-To:1': 0.21; 'values': 0.25; 'received:209.85.220': 0.25; 'message-id:@mail.gmail.com': 0.28; 'position.': 0.29; 'unicode': 0.29; 'value.': 0.32; 'file.': 0.32; 'to:addr:python-list': 0.33; 'starting': 0.33; 'file': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.37; 'sequence': 0.37; 'think': 0.38; 'subject:: ': 0.38; 'called': 0.39; 'received:209': 0.39; 'attempt': 0.39; 'returned': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'results': 0.60; 'within': 0.60; 'subject:? ': 0.67; 'strange': 0.68; 'subject:line': 0.73; '2:00': 0.84; 'presumably': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=D4T+lYvQSkTqvDgsQcQwInrEbW+gSg6DkK2x8sFh5t8=; b=gY+b2SRNXuBC/6NDudUwgLk9zWOzh1HbgnWX+dyzXzKmQ4TwQZrs5jvXU4gDvyrgvU mWhFnaS3GG5a3b9r4SWVOoA9adgKgf5+929ZXlr1ReFA1HXyDHHd46pwPVY2GO7rvnVQ 0dU6Dwv5d/Tc+QqPFNIO/dZ+G8zuwdNO+6NYs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=bVPSgw2mdIn4riHytCWeqGcntrh4RWHvCIF8BV96R8bz8jjILPQUs3qWj8BFvlBjI2 42z6OuMZeF/pdWMKBiEENLDR4CtGe3MZyTYrZZIVbpU5Uz9N+7/I56o1wzfxcIjQuPXa ggOfwI1r8ZNUqYK+Ywz++eTOk7DGOcCtjj0Wc= MIME-Version: 1.0 In-Reply-To: <4DDD5FD2.8040607@mrabarnett.plus.com> References: <3d81e2a0-6c86-4f12-a1c4-ce4c736172b6@y31g2000vbp.googlegroups.com> <4DDD5FD2.8040607@mrabarnett.plus.com> From: Ian Kelly Date: Wed, 25 May 2011 14:54:25 -0600 Subject: Re: Python 3.2 bug? Reading the last line of a file To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 13 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306356898 news.xs4all.nl 49041 [::ffff:82.94.164.166]:48188 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6262 On Wed, May 25, 2011 at 2:00 PM, MRAB wrote: > You're opening the file in text mode, and seeking relative to the end > of the file is not allowed in text mode, presumably because the file > contents have to be decoded, and, in general, seeking to an arbitrary > position within a sequence of encoded bytes can have undefined results > when you attempt to decode to Unicode starting from that position. > > The strange thing is that you _are_ allowed to seek relative to the > start of the file. I think that with text files seek() is only really meant to be called with values returned from tell(), which may include the decoder state in its return value.