Maybe this helps: >>> import types >>> def foo(inputVal): inValType = type(inputVal) if inValType==types.ListType or inValType==types.TupleType: for val in inputVal: print val else: print 'Wrong input Type' >>> list = [1,2,3,4] >>> foo(list) 1 2 3 4 >>> tup = ('a', 'b', 'c') >>> foo(tup) a b c >>> foo(9) Wrong input Type >>>