The opener parameter of Python 3 open() built-in
Antoine Pitrou
solipsis at pitrou.net
Wed Sep 5 20:34:56 EDT 2012
Chris Angelico <rosuav <at> gmail.com> writes:
>
> On Wed, Sep 5, 2012 at 5:16 AM, Terry Reedy <tjreedy <at> 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?
Monkey-patching globals is not thread-safe: other threads will see your
modification, which is risky and fragile.
Regards
Antoine.
--
Software development and contracting: http://pro.pitrou.net
More information about the Python-list
mailing list