Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91352
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gherron@digipen.edu> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.05; 'builtin': 0.07; 'override': 0.07; 'returned.': 0.07; 'subject:file': 0.07; 'builtins': 0.09; 'subsequent': 0.15; "can't.": 0.16; 'guessing': 0.16; 'modules,': 0.16; 'namespace.': 0.16; 'python3:': 0.16; 'shooting': 0.16; 'subject:object': 0.16; 'wrote:': 0.16; 'module,': 0.18; '>>>': 0.20; 'assign': 0.22; 'import': 0.24; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'question': 0.26; "doesn't": 0.28; "i'm": 0.29; 'skip:_ 10': 0.32; 'probably': 0.32; 'open': 0.33; 'to:addr:python-list': 0.35; 'subject:: ': 0.37; 'doing': 0.38; 'is,': 0.38; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'subject: (': 0.40; 'your': 0.60; 'course': 0.64; 'within': 0.64; 'dr.': 0.69; 'yourself': 0.73; 'received:204': 0.75; 'institute': 0.77; '(425)': 0.84; '895-4418': 0.84; 'can:': 0.84; 'digipen': 0.84; 'herron': 0.84; 'pain': 0.84; 'do:': 0.91 |
| Date | Wed, 27 May 2015 22:56:41 -0700 |
| From | Gary Herron <gherron@digipen.edu> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Returning a custom file object (Python 3) |
| References | <55667a6d$0$13002$c3e8da3$5496439d@news.astraweb.com> <85iobdwhti.fsf@benfinney.id.au> <mailman.113.1432780860.5151.python-list@python.org> <87wpztclsu.fsf@elektro.pacujo.net> |
| In-Reply-To | <87wpztclsu.fsf@elektro.pacujo.net> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| 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.120.1432792612.5151.python-list@python.org> (permalink) |
| Lines | 47 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1432792612 news.xs4all.nl 2861 [2001:888:2000:d::a6]:53477 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91352 |
Show key headers only | View raw
On 05/27/2015 10:29 PM, Marko Rauhamaa wrote: > Ben Finney <ben+python@benfinney.id.au>: > >> It seems the existing ‘open’ implementation doesn't allow you to >> override the type of object returned. > The question is, can you assign to the builtin namespace. I'm guessing > you can't. Of course you can. Python2: >>> __builtins__.open = "whatever" >>> Python3: >>> import builtins >>> builtins.open = "whatever" >>> Of course doing so is like shooting yourself in the foot: Any subsequent pain is your own fault and probably well deserved. Gary Herron > > Within a module, you can simply do: > > open = MyFile > > Also, in other modules, you can: > > from myfile import open > > > Marko -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418
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