"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> How do I know type of simple object is tuple or list or integer, for
> example my function should understand what is the object type passed in
> its argument
Answers ordered in decreasing degree of Pythonicity:
1) You are mistaken, the function almost certainly should not care
whether the object is a tuple or a list (or integer)[1].
2) isinstance(obj, list) etc.
3) type(obj)
[1] You probably want to check whether the object is capable of doing
whatever it is that you expect lists or tuples to do for you. For
example:
def total(object):
try:
return sum(object) # The list-or-tuple case
except TypeError:
return object # The integer case
--
http://mail.python.org/mailman/listinfo/python-list