problem of types:
Fredrik Lundh
fredrik at pythonware.com
Sat Jan 14 03:22:52 EST 2006
Laurent wrote:
> I do not understand why he is talking me about 'str', no str given!!!
>
> I have this:
>
> ---------------------------------------------
>
> def to_float(elt):
> if type(elt) is list:
this uses type
> if __name__ == '__main__':
> A = [[1,0],[0,1]]
> b = [2,2]
> c = [1,1]
> type = 'min'
and this sets type to a string.
> if type(elt) is list:
> TypeError: 'str' object is not callable
>
> Changing 'list' to 'type(list)' don't change anything!!!!
that's because the error says that you're trying to call a string,
which is exactly what happens here.
</F>
More information about the Python-list
mailing list