[Tutor] "TypeError: 'int' object is not callable"??

Kent Johnson kent37 at tds.net
Fri Dec 17 23:43:58 CET 2004


Jacob S. wrote:
> Hey, could you give an example?

I'll try...

Here is range with three explicit arguments
  >>> range(1, 10, 2)
[1, 3, 5, 7, 9]

Here is range with the arguments supplied in a list; it does the same thing
  >>> args = [1, 10, 2]
  >>> range(*args)
[1, 3, 5, 7, 9]

Here is an example with zip(). zip() normally takes multiple arguments, this makes it use elements 
of a single list:
  >>> l=[ [1,2], [3,4], [5,6] ]
  >>> zip(*l)
[(1, 3, 5), (2, 4, 6)]

Kent

> Thanks,
> Jacob
> 
> 
>>apply() is deprecated; it has been replaced by 'extended call syntax'.
> 
> Instead of
> 
>>   apply(fn, args, kwds)
>>you can now write
>>   fn(*args, **kwds)
>>
>>Kent
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
>>
> 
> 
> 


More information about the Tutor mailing list