Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28429

Re: The opener parameter of Python 3 open() built-in

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'case.': 0.05; 'dependency': 0.07; 'api': 0.09; 'builtins': 0.09; 'sep': 0.09; 'terry': 0.09; 'bug': 0.10; 'dangerous,': 0.16; 'descriptor.': 0.16; 'exposes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'internals,': 0.16; 'reedy': 0.16; 'replaced.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'module': 0.19; 'explicit': 0.22; 'this:': 0.23; 'patch': 0.24; 'idea': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'necessary.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'mind,': 0.29; 'received:209.85.210.174': 0.30; 'received :mail-iy0-f174.google.com': 0.30; 'function': 0.30; 'file': 0.32; 'comments': 0.33; 'to:addr:python-list': 0.33; 'knowledge': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'depends': 0.36; "didn't": 0.36; 'should': 0.36; 'too': 0.36; 'why': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'most': 0.61; 'subject:The': 0.71; 'confusing': 0.84; 'opener': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=QOIF/t/vtWVCOoeAmI3JMB51geB7JEzVO+FnCHkgkFc=; b=fjNmGcFqSQ/EXG1/nvIPqb9vE+w/Skm2fWHAWlEGnJ+9QSHudODTIAPQdrewMqoD3o xJ94oESlSi6FmFt4jcVVNnBcOmkU293KYrcLBOLFcDD5wV/vMR/mlWpVsAO80xy7mRTX IWehBbLS7v9/vI9hQEWM4Z7Y+xVIdn/7xp6JymKytxJa0zp5MCHRt1k8GO4VGtPUoGIT xgEaLG3NKItiJjDiE36D9TclCwUkUuXdDosQ0c8mH+MmdzYZwwKZOYRXWel4qnNQS/B9 wcp4Zi01KBrHNWvBRm6/zwwZKSfcUZNTCBek2O6awVrrWjBJiAGzgZMsYKDicdQCKQ6m vh0A==
MIME-Version 1.0
In-Reply-To <k25k2r$8tc$1@ger.gmane.org>
References <k2280c$nf1$1@speranza.aioe.org> <mailman.139.1346678967.27098.python-list@python.org> <504555a5$0$29978$c3e8da3$5496439d@news.astraweb.com> <k24tt1$jv8$1@ger.gmane.org> <k25k2r$8tc$1@ger.gmane.org>
Date Wed, 5 Sep 2012 08:18:57 +1000
Subject Re: The opener parameter of Python 3 open() built-in
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
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.195.1346797140.27098.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346797140 news.xs4all.nl 6920 [2001:888:2000:d::a6]:53487
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28429

Show key headers only | View raw


On Wed, Sep 5, 2012 at 5:16 AM, Terry Reedy <tjreedy@udel.edu> wrote:
> io.open depends on a function the returns an open file descriptor. opener
> exposes that dependency so it can be replaced.

I skimmed the bug report comments but didn't find an answer to this:
Why not just monkey-patch? When a module function calls on a support
function and you want to change that support function's behaviour,
isn't monkey-patching the most usual?

Several possibilities come to mind, but without knowledge of
internals, I have no idea what's actually the case.
* Patching builtins is too confusing or dangerous, and should be avoided?
* You want to narrow the scope of the patch rather than do it globally?
* Explicit is better than implicit?

It just strikes me as something where an API change may not be necessary.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

The opener parameter of Python 3 open() built-in Marco <marco_u@nsgmail.com> - 2012-09-03 14:32 +0200
  Re: The opener parameter of Python 3 open() built-in Dave Angel <d@davea.name> - 2012-09-03 09:05 -0400
    Re: The opener parameter of Python 3 open() built-in Marco <marco_u@nsgmail.com> - 2012-09-03 15:33 +0200
    Re: The opener parameter of Python 3 open() built-in Marco <marco.buttu@gmail.com> - 2012-09-03 15:33 +0200
  Re: The opener parameter of Python 3 open() built-in Christian Heimes <lists@cheimes.de> - 2012-09-03 15:29 +0200
    Re: The opener parameter of Python 3 open() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-04 01:13 +0000
      Re: The opener parameter of Python 3 open() built-in Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-03 23:19 -0400
        Re: The opener parameter of Python 3 open() built-in Ben Finney <ben+python@benfinney.id.au> - 2012-09-04 15:12 +1000
          Re: The opener parameter of Python 3 open() built-in Ben Finney <ben+python@benfinney.id.au> - 2012-09-04 15:20 +1000
          Re: The opener parameter of Python 3 open() built-in Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-04 14:44 -0400
        Re: The opener parameter of Python 3 open() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-04 05:25 +0000
          Re: The opener parameter of Python 3 open() built-in Ben Finney <ben+python@benfinney.id.au> - 2012-09-04 15:45 +1000
      Re: The opener parameter of Python 3 open() built-in Serhiy Storchaka <storchaka@gmail.com> - 2012-09-04 15:58 +0300
      Re: The opener parameter of Python 3 open() built-in Terry Reedy <tjreedy@udel.edu> - 2012-09-04 15:16 -0400
      Re: The opener parameter of Python 3 open() built-in Chris Angelico <rosuav@gmail.com> - 2012-09-05 08:18 +1000
      Re: The opener parameter of Python 3 open() built-in Terry Reedy <tjreedy@udel.edu> - 2012-09-04 19:16 -0400
      Re: The opener parameter of Python 3 open() built-in Antoine Pitrou <solipsis@pitrou.net> - 2012-09-06 00:34 +0000
        Re: The opener parameter of Python 3 open() built-in Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-06 06:34 +0000
  Re: The opener parameter of Python 3 open() built-in Serhiy Storchaka <storchaka@gmail.com> - 2012-09-03 19:06 +0300
  Re: The opener parameter of Python 3 open() built-in Serhiy Storchaka <storchaka@gmail.com> - 2012-09-04 16:01 +0300

csiph-web