Because you can't take the len() of an integer. Try casting a as a str: b=(1,len(str(a)))[isinstance(a,(list,tuple,dict))]
-----Original Message----- From: It's me [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 12, 2005 12:35 PM To: python-list@python.org Subject: Why would I get a TypeEror? For this code snip: a=3 .... b=(1,len(a))[isinstance(a,(list,tuple,dict))] Why would I get a TypeError from the len function? Thanks, -- http://mail.python.org/mailman/listinfo/python-list