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


Groups > comp.lang.python > #33066

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

From aahz@pythoncraft.com (Aahz)
Newsgroups comp.lang.python
Subject Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py
Date 2012-11-09 16:42 -0800
Organization The Cat & Dragon
Message-ID <k7k7u3$rr0$1@panix5.panix.com> (permalink)
References <a4a2e63b-d25d-4487-bff8-67d4b7c40cbc@googlegroups.com> <83af64e3-bc26-4217-8afa-e4f6d45b604d@googlegroups.com> <504eb3fc$0$29890$c3e8da3$5496439d@news.astraweb.com> <k2p9da$ktu$1@r03.glglgl.gl>

Show all headers | View raw


In article <k2p9da$ktu$1@r03.glglgl.gl>,
Thomas Rachel  <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> wrote:
>Am 11.09.2012 05:46 schrieb Steven D'Aprano:
>>
>> Good for you. (Sorry, that comes across as more condescending than it is
>> intended as.) Monkey-patching often gets used for quick scripts and tiny
>> pieces of code because it works.
>>
>> Just beware that if you extend that technique to larger bodies of code,
>> say when using a large framework, or multiple libraries, your experience
>> may not be quite so good. Especially if *they* are monkey-patching too,
>> as some very large frameworks sometimes do. (Or so I am lead to believe.)
>
>This sonds like a good use case for a context manager, like the one in 
>decimal.Context.get_manager().

Note that because get_manager() applies to a specific Context instance it
is safe in a threaded application, which is NOT true for monkey-patching
modules even with a context manager.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"....Normal is what cuts off your sixth finger and your tail..."  --Siobhan

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


Thread

how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py ruck <john.ruckstuhl@gmail.com> - 2012-09-10 10:25 -0700
  Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-10 20:16 +0000
    Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py ruck <john.ruckstuhl@gmail.com> - 2012-09-10 15:22 -0700
      Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-11 03:46 +0000
        Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Tim Golden <mail@timgolden.me.uk> - 2012-09-11 08:20 +0100
          Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py ruck <john.ruckstuhl@gmail.com> - 2012-09-11 12:13 -0700
            Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Chris Angelico <rosuav@gmail.com> - 2012-09-12 08:50 +1000
            Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Dave Angel <d@davea.name> - 2012-09-11 18:57 -0400
          Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py ruck <john.ruckstuhl@gmail.com> - 2012-09-11 12:13 -0700
        Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-12 08:17 +0200
          Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py aahz@pythoncraft.com (Aahz) - 2012-11-09 16:42 -0800

csiph-web