From 300430fbba28b408f7ac86ca46b03d9d50839399 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 24 Jun 2009 17:13:22 +0200 Subject: overload resolution for proc vars --- pycompab.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pycompab.py') diff --git a/pycompab.py b/pycompab.py index 3121856ef..c6752bee3 100644 --- a/pycompab.py +++ b/pycompab.py @@ -68,11 +68,16 @@ def Subs(frmt, *args, **substitution): a = args result = [] i = 0 + num = 0 L = len(frmt) while i < L: if frmt[i] == '$': i = i+1 - if frmt[i] == '$': + if frmt[i] == '#': + result.append(a[num]) + num = num+1 + i = i+1 + elif frmt[i] == '$': result.append('$') i = i+1 elif frmt[i] == '{': @@ -91,7 +96,8 @@ def Subs(frmt, *args, **substitution): while i < len(frmt) and frmt[i] in chars: i = i + 1 x = frmt[j:i] if x[0] in DIGITS: - result.append(str(a[int(x)-1])) + num = int(x) + result.append(str(a[num-1])) else: result.append(str(d[x])) else: -- cgit 1.4.1-2-gfad0