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

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 2012-09-05 08:18 +1000
Subject Re: The opener parameter of Python 3 open() built-in
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.195.1346797140.27098.python-list@python.org> (permalink)

Show all headers | 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