Re: Loading functions from a file during run-time

2005-02-19 Thread Bryant Huang
Ah, thank you, Wensheng and T.J.! I have drawn bits and pieces from what you have suggested. Both of your solutions work well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading functions from a file during run-time

2005-02-11 Thread Bryant Huang
Ah, thanks a lot, Grant and Nick. Let me try to clarify because I think I was unclear in specifying what I want to do: 1. Read in a file containing a bunch of function definitions: def f1(x): ... def f2(x): ... def f3(x): ... def f4(x): ... 2. In wxPython, populate a

Loading functions from a file during run-time

2005-02-10 Thread Bryant Huang
Hello! I would like to read in files, during run-time, which contain plain Python function definitions, and then call those functions by their string name. In other words, I'd like to read in arbitrary files with function definitions, using a typical 'open()' call, but then have those functions av

Iteration within re.sub()?

2004-12-14 Thread Bryant Huang
Hi, Is it possible to perform iteration within the re.sub() function call? For example, if I have a string like: str = "abbababbabbaaa" and I want to replace all b's with an integer that increments from 0, could I do that with re.sub()? Replacing b's with 0's is trivial: i = 0 pat = re.compil

Re: Iteration within re.sub()?

2004-12-14 Thread Bryant Huang
Ah beautiful, thank you both, Robert and Mark, for your instant and helpful responses. I understand, so the basic idea is to keep a variable that is globally accessible and call an external function to increment that variable... Thanks! Bryant -- http://mail.python.org/mailman/listinfo/python-li