Why would I get a TypeEror?
harold.fellermann at upf.edu
Wed Jan 12 13:16:35 EST 2005
On 12.01.2005, at 18:35, It's me wrote:
> For this code snip:
> Why would I get a TypeError from the len function?
the problem is, that (1,len(a)) is evaluated, neither what type a
(python has no builtin lazy evaluation like ML). You have to do it this
b = isinstance(a,(list,tuple,dict)) and len(a) or 1
- harold -
The opposite of a correct statement is a false statement.
But the opposite of a profound truth may be another profound truth.
-- Niels Bohr
More information about the Python-list