Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91343
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'attributes': 0.07; 'override': 0.07; 'returned.': 0.07; 'subject:file': 0.07; 'open()': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:object': 0.16; '2001': 0.18; 'preferred': 0.20; 'parameter': 0.22; "haven't": 0.24; 'seems': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; "doesn't": 0.28; 'no,': 0.29; 'there.': 0.30; 'classes': 0.30; 'returned': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'to:addr:python-list': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'received:org': 0.38; 'say': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'subject: (': 0.40; 'your': 0.60; 'god': 0.67; '8bit%:21': 0.70; '_o__)': 0.84; 'received:125': 0.84; 'belief': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben+python@benfinney.id.au> |
| Subject | Re: Returning a custom file object (Python 3) |
| Date | Thu, 28 May 2015 12:40:53 +1000 |
| References | <55667a6d$0$13002$c3e8da3$5496439d@news.astraweb.com> <85iobdwhti.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| Cancel-Lock | sha1:TnpuuC3pZuM/82nMej6S95uPzO8= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.113.1432780860.5151.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1432780860 news.xs4all.nl 2852 [2001:888:2000:d::a6]:33139 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91343 |
Show key headers only | View raw
Ben Finney <ben+python@benfinney.id.au> writes: > Steven D'Aprano <steve@pearwood.info> writes: > > > but how do I tell open() to use MyFile? > > I haven't used it, but does the ‘opener’ parameter do what you want? No, it doesn't; the ‘opener’ parameter doesn't have any say in the type of object returned from ‘open’. It seems the existing ‘open’ implementation doesn't allow you to override the type of object returned. You may have to resort to monkey-patching the ‘io’ attributes to put your preferred classes there. -- \ “Science shows that belief in God is not only obsolete. It is | `\ also incoherent.” —Victor J. Stenger, 2001 | _o__) | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Returning a custom file object (Python 3) Steven D'Aprano <steve@pearwood.info> - 2015-05-28 12:16 +1000
Re: Returning a custom file object (Python 3) Ben Finney <ben+python@benfinney.id.au> - 2015-05-28 12:40 +1000
Re: Returning a custom file object (Python 3) Marko Rauhamaa <marko@pacujo.net> - 2015-05-28 08:29 +0300
Re: Returning a custom file object (Python 3) Chris Angelico <rosuav@gmail.com> - 2015-05-28 15:49 +1000
Re: Returning a custom file object (Python 3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-28 17:04 +1000
Re: Returning a custom file object (Python 3) Chris Angelico <rosuav@gmail.com> - 2015-05-28 19:06 +1000
Re: Returning a custom file object (Python 3) Gary Herron <gherron@digipen.edu> - 2015-05-27 22:56 -0700
Re: Returning a custom file object (Python 3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-28 16:52 +1000
Re: Returning a custom file object (Python 3) Ben Finney <ben+python@benfinney.id.au> - 2015-05-28 12:34 +1000
Re: Returning a custom file object (Python 3) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-05-28 10:29 +0100
csiph-web