In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Thank you so much it answers my humble question perfectly:) >
HOWEVER, to answer you final question, yes, there is a different and, in general, better, way. While there's a lot to say about good Python style and typing, I'll summarize at a high level: you shouldn't have to check types. I can understand that you are working to make a particular function particularly robust, and are trying to account for a wide range of inputs. This is healthy. In stylish Python, though, you generally don't need type checking. How would it be, for example, if someone passed the number 3 to your function. Is that an error? Do you want it automatically interpreted as the string "3"? You can achieve these results withOUT a sequence of if isinstance(... elif isinstance(... ... perhaps with something as simple as my_input = str(my_input). One of us will probably follow-up with a reference to a more detailed write-up of the subject. -- http://mail.python.org/mailman/listinfo/python-list