[Tutor] What is the square bracket about?
Ivan Low
lowseotoh at gmail.com
Sat Jul 22 14:49:52 CEST 2006
def adder1(*args):
print 'adder1',
if type(args[0]) == type(0):
sum = 0
else:
sum = args[0][:0]
for arg in args:
sum = sum + arg
return sum
Hi, I was trying to understand what this function is all about.
I didn't tried the adder1 function which result in adding number or
text together which I think there is an easier way to do it right?
Why go through all the way to write a function like this?
The square is a big mystery to me. I can't explain why it is there.
I tried sum(1,2,3) and sum('a','b','c') it wouldn't work. I even
search the document and I can't find anything there.
Ivan
More information about the Tutor
mailing list