[Tutor] Strange error

Peter Otten __peter__ at web.de
Thu Nov 19 05:31:56 EST 2015


jarod_v6--- via Tutor wrote:

> HI!!
> This is my list:
> 
> In [378]: type(Span)
> Out[378]: list
> 
> In [379]: Span
> Out[379]:
> [['M02898:39:000000000-AH4BK:1:2107:17412:10850',
>   'M02898:39:000000000-AH4BK:1:2117:15242:18766',
>   'M02898:39:000000000-AH4BK:1:1112:21747:21214',
>   'M02898:39:000000000-AH4BK:1:2112:5119:9813',
>   'M02898:39:000000000-AH4BK:1:1102:26568:5630',
>   'M02898:39:000000000-AH4BK:1:2118:19680:11792',
>   'M02898:39:000000000-AH4BK:1:1103:5469:6578',
>   'M02898:39:000000000-AH4BK:1:2101:13087:20965',
>   'M02898:39:000000000-AH4BK:1:1103:28031:13653',
>   'M02898:39:000000000-AH4BK:1:1103:8013:21346',
>   'M02898:39:000000000-AH4BK:1:1107:9189:22557',
>   'M02898:39:000000000-AH4BK:1:2118:21263:23091',
>   'M02898:39:000000000-AH4BK:1:1115:12279:20054',
>   'M02898:39:000000000-AH4BK:1:1102:19433:17489',
>   'M02898:39:000000000-AH4BK:1:1110:14533:11792',
>   'M02898:39:000000000-AH4BK:1:2106:18027:12878',
>   'M02898:39:000000000-AH4BK:1:1104:4408:6824',
>   'M02898:39:000000000-AH4BK:1:2101:5678:7400']]
> 
> I have this error
> 
> 
> In [381]: len(Span)
> 
---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last) <ipython-input-381-6f83caae0041> in <module>()
> ----> 1 len(Span)
> 
> TypeError: 'str' object is not callable
> 
> 
> 
> Why??? IS a list!!!

My crystal ball says that this is self-inflicted pain. You shaded the built-
by typing

In [81]: len = "whatever"

and then forgot about it until after 300 more lines. To make the built-in 
len() function visible again delete the string in the global namespace of 
the __main__ module with

In [382]: del len





More information about the Tutor mailing list