how to replace some methods with instrumented ones

2015-06-26 Thread georgeryoung
[python 2.7, linux] I have a python app. I cannot modify the file. But I can import it and mess with it. I need to perform brief tasks before and after some of the member functions. I'd like to do this in as clear and maintainable way as possible (no third party imports). Here's what I have

Re: case-sensitive configparser without magical interpolation?

2015-05-22 Thread georgeryoung
On Friday, May 22, 2015 at 1:13:39 PM UTC-4, Ian wrote: > On Fri, May 22, 2015 at 10:59 AM, gy wrote: > > [python 2.7] > > I need to use a configparser that is case-sensitive for option names, but > > does not do magical interpolation of percent sign. > > I.e.: > > > > [Mapping0] > > backupHost =

case-sensitive configparser without magical interpolation?

2015-05-22 Thread georgeryoung
[python 2.7] I need to use a configparser that is case-sensitive for option names, but does not do magical interpolation of percent sign. I.e.: [Mapping0] backupHost = eng%26 dbNode = v_br_node0001 should be read (and later written) as is, including capitalization and the percent sign. I f

Re: question about loading variables from a file...

2006-11-05 Thread georgeryoung
On Nov 5, 2:26 pm, avidfan <[EMAIL PROTECTED]> wrote: > Can someone offer some advice as to how the best way to approach this > might be? > > I am trying to write a generic python script to build out some > applications, so the python script will be generic enough to work for > all of them, but it

Re: best way to check if a file exists?

2006-10-31 Thread georgeryoung
On Oct 31, 4:01 pm, John Salerno <[EMAIL PROTECTED]> wrote: > What is the best way to check if a file already exists in the current > directory? I saw os.path.isfile(), but I'm not sure if that does more > than what I need. > > I just want to check if a file of a certain name exists before the user

what is "@param" in docstrings?

2006-10-28 Thread georgeryoung
I'm starting to read about twisted and I keep seeing things like: [from twisted/internet/app.py] def __init__(self, name, uid=None, gid=None, authorizer=None, authorizer_=None): """Initialize me. If uid and gid arguments are not provided, this application will default t

Re: User Access to the docstring of a property

2006-10-20 Thread georgeryoung
Colin J. Williams wrote: > Is there some way that the user can access the docstring specified for a > property? Do keep in mind that the docstring is not guaranteed to be available. If the application is run with optimization turned on, docstrings are usually optimized out. Docstrings are handy

Re: Flexable Collating (feedback please)

2006-10-18 Thread georgeryoung
On Oct 18, 2:42 am, Ron Adam <[EMAIL PROTECTED]> wrote: > I put together the following module today and would like some feedback on any > obvious problems. Or even opinions of weather or not it is a good approach. ,,, def __call__(self, a, b): """ This allows the Collate class work

Re: why should dict not be callable?

2006-10-17 Thread georgeryoung
On Oct 17, 3:37 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > A couple of times recently I've come across this problem: I have a > > large list to sort and I need to the the "key=function" argument to > > sort appropriately. But I actually have the key mapping in a b

why should dict not be callable?

2006-10-17 Thread georgeryoung
A couple of times recently I've come across this problem: I have a large list to sort and I need to the the "key=function" argument to sort appropriately. But I actually have the key mapping in a big dictionary. Now I have to make an intermediary function: def key_fn(key): return key_dict[ke

Re: returning None instead of value: how to fix?

2006-09-22 Thread georgeryoung
sam wrote: > i am starting to experiment with recursion, and decided to write a > fairly trivial little program which took a float as input, then called > a function to halve it recursively until it was less than 1: > > import recu

Re: get process id...

2006-09-20 Thread georgeryoung
SpreadTooThin wrote: > How does one get the process id? > Is there a method for windows and unix (mac os x etc...) under linux, do: import os os.getpid() -- http://mail.python.org/mailman/listinfo/python-list