Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29935
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| 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; 'python.': 0.02; 'python,': 0.02; 'attribute': 0.05; 'method.': 0.05; 'attributes': 0.07; 'parameter': 0.07; 'subject:file': 0.07; 'api': 0.09; 'abstraction': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; 'suggest': 0.11; 'file,': 0.15; 'simplified': 0.16; 'subject:API': 0.16; 'thoughts?': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'pointer': 0.17; 'operations.': 0.22; 'cc:2**0': 0.23; 'absolute': 0.23; "i've": 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'interface': 0.27; '>>>>': 0.29; 'arithmetic': 0.29; 'obscure': 0.29; 'optional': 0.29; 'position.': 0.30; 'relative': 0.30; 'basic': 0.30; 'file': 0.32; 'legacy': 0.33; 'rid': 0.33; 'done': 0.34; 'replaced': 0.35; 'pm,': 0.35; 'but': 0.36; 'wanted': 0.36; 'should': 0.36; 'two': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.39; 'easily': 0.39; 'called': 0.39; 'received:192.168': 0.40; 'address': 0.60; "you've": 0.61; 'more': 0.63; 'removal': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84 |
| Date | Mon, 24 Sep 2012 17:49:16 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | zipher <dreamingforward@gmail.com> |
| Subject | Re: python file API |
| References | <0ec1fe2e-890c-4e25-8047-4cb8bee0aa95@googlegroups.com> |
| In-Reply-To | <0ec1fe2e-890c-4e25-8047-4cb8bee0aa95@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:8P7f87JOvv9g2cU5tRAvAagLTt1X1Cq9TFbWYxaDfIg 692Xh8F8gwcJR5t6VzSyS0AHxhZiCXQdQDBSBs88x60Ezce1ql eg46hOE4v4KZc/FAC1QGDFhHbC6D2em1WRLXDRcpEmRz6PAyi6 +CExFoOjJJAktHgDIbmMCbnafyyTTJ4XfpoiSt3k4M8o2Fkbbb Fh9n0ypmnp62BEY/ek1WBxC01EuZK+RcpmhquuKGdQiznzXFIE ZkzyUTZSOi6tp+cgyuVG3MzcpROlBTSXQ3mVwPVcBEXJvO8mWV snya7wOXDDWVB18iF/+tC2UIKXa4AHk4njhiz5ot5piwb6H1A= = |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | d@davea.name |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1217.1348523382.27098.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348523382 news.xs4all.nl 6884 [2001:888:2000:d::a6]:56841 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29935 |
Show key headers only | View raw
On 09/24/2012 05:35 PM, zipher wrote: > For some time now, I've wanted to suggest a better abstraction for the <file> type in Python. It currently uses an antiquated C-style interface for moving around in a file, with methods like tell() and seek(). But after attributes were introduced to Python, it seems it should be re-addressed. > > Let file-type have an attribute .pos for position. Now you can get rid of the seek() and tell() methods and manipulate the file pointer more easily with standard arithmetic operations. > >>>> file.pos = x0ae1 #move file pointer to an absolute address >>>> file.pos +=1 #increment the file pointer one byte >>>> curr_pos = file.pos #read current file pointer > You've now simplified the API by the removal of two obscure legacy methods and replaced them with a more basic one called "position". > > Thoughts? > > markj And what approach would you use for positioning relative to end-of-file? That's currently done with an optional second parameter to seek() method. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
python file API zipher <dreamingforward@gmail.com> - 2012-09-24 14:35 -0700
Re: python file API Dave Angel <d@davea.name> - 2012-09-24 17:49 -0400
Re: python file API Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-09-25 08:22 +0200
Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 04:19 -0400
Re: python file API Grant Edwards <invalid@invalid.invalid> - 2012-09-25 14:07 +0000
Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 12:07 -0400
Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-26 02:12 +1000
Re: python file API Chris Kaynor <ckaynor@zindagigames.com> - 2012-09-24 14:58 -0700
Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-25 08:14 +1000
Re: python file API zipher <dreamingforward@gmail.com> - 2012-09-24 15:36 -0700
Re: python file API Mark Adam <dreamingforward@gmail.com> - 2012-09-24 21:32 -0500
Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 08:27 +0100
Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 11:51 +0100
Re: python file API zipher <dreamingforward@gmail.com> - 2012-09-24 15:36 -0700
Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 02:28 +0000
Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:25 +0200
Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 07:28 +0000
Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 21:40 +0200
Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 01:33 +0000
Re: python file API Dave Angel <d@davea.name> - 2012-09-24 18:36 -0400
Re: python file API Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-24 16:37 -0600
Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:32 +0200
Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 04:13 -0400
Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 11:53 +0200
Re: python file API Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-25 03:32 -0600
Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-25 08:57 +1000
Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 00:12 +0100
Re: python file API Chris Kaynor <ckaynor@zindagigames.com> - 2012-09-24 16:14 -0700
Re: python file API Ramchandra Apte <maniandram01@gmail.com> - 2012-09-30 05:50 -0700
csiph-web