Trouble Understanding O'Reilly Example

Chris chris at suse.local
Mon Apr 26 00:12:46 EDT 2004


slyraymond wrote:

> def min1(*args):
> res = args[0]
> for arg in args[1:]:
> if arg < args:
> res = arg
> return res
Apologizing for whatever damage knode did to the formatting, try:

if arg < res:

instead of

if arg < args

For debugging purposes, add the line

print args

just before the return statement to see exactly what is going on.

Chris



More information about the Python-list mailing list