I'm trying to implement a conditional branch based on a variable type. For example, if c is a character and s is a set with only one member.
c = "9" s ={9} if type(c) == a string: do this else: do that An alternative that I've attempted is to test if a set contains one member based on len(). However, I then cannot tell if len() is referring to a single character or a single set with one member. So I'm back to square one. A for loop is indexing mixed lists of characters (one character per list) and lists that a set with one member. I'm only interested in the sets and want to ignore the character lists. I have come up with a method that will probably work but it's become quite messy with multiple compare statements. Something simple and less prone to cause headaches would be better. -- Regards, Phil _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor