function that counts...
Jerry Hill
malaclypse2 at gmail.com
Wed May 19 16:46:43 EDT 2010
On Wed, May 19, 2010 at 4:25 PM, superpollo <utente at esempio.net> wrote:
> Jerry Hill ha scritto:
>> sumofdigits = sum(int(char) for char in str(testval))
>
> this line gives me this:
>
> TypeError: 'int' object is not callable
>
> is it some new feature in >2.5 ?
No, sum() has been a builtin since Python 2.3. Based on your first
post, you have probably shadowed the builtin "sum" function by
assigning an integer to a variable named "sum".
--
Jerry
More information about the Python-list
mailing list