Who knows why I wrote that without a for loop before?

This commit is contained in:
Jeremy Fincher 2004-02-16 00:54:05 +00:00
parent 487fb3cc2f
commit ff370e29cf
1 changed files with 6 additions and 9 deletions

View File

@ -224,27 +224,24 @@ def separateModes(args):
assert modes[0] in '+-', 'Invalid args: %r' % args
args = list(args[1:])
ret = []
index = 0
length = len(modes)
while index < length:
if modes[index] in '+-':
last = modes[index]
index += 1
for c in modes:
if c in '+-':
last = c
else:
if last == '+':
requireArguments = _plusRequireArguments
else:
requireArguments = _minusRequireArguments
if modes[index] in requireArguments:
if c in requireArguments:
arg = args.pop(0)
try:
arg = int(arg)
except ValueError:
pass
ret.append((last + modes[index], arg))
ret.append((last + c, arg))
else:
ret.append((last + modes[index], None))
index += 1
ret.append((last + c, None))
return ret
def joinModes(modes):