Skip to content

Commit

Permalink
Expanded test function to allow any number of arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Nov 25, 1997
1 parent 78385ee commit 7f095bf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions DT_Util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'''$Id: DT_Util.py,v 1.17 1997/11/19 15:42:47 jim Exp $'''
'''$Id: DT_Util.py,v 1.18 1997/11/25 15:20:30 jim Exp $'''

############################################################################
# Copyright
Expand Down Expand Up @@ -52,7 +52,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.17 $'[11:-2]
__version__='$Revision: 1.18 $'[11:-2]

import sys, regex, string, types, math, os
from string import rfind, strip, joinfields, atoi,lower,upper,capitalize
Expand Down Expand Up @@ -127,9 +127,12 @@ def careful_getslice(md, seq, *indexes):
d['string']=string
d['math']=math

def test(cond, t, f):
if cond: return t
return f
def test(*args):
l=len(args)
for i in range(1, l, 2):
if args[i-1]: return args[i]

if l%2: return args[-1]

d['test']=test

Expand Down Expand Up @@ -287,6 +290,9 @@ def parse_params(text,

############################################################################
# $Log: DT_Util.py,v $
# Revision 1.18 1997/11/25 15:20:30 jim
# Expanded test function to allow any number of arguments.
#
# Revision 1.17 1997/11/19 15:42:47 jim
# added _ prefix to push and pop methods to make them private
#
Expand Down

0 comments on commit 7f095bf

Please sign in to comment.