Python 3 isinstance
Lambert, David W (S&T)
LambertDW at Corning.com
Thu Jan 15 11:50:22 EST 2009
I have use case, needn't be dynamic, and it's not hard to enclose set as
tuple. But I also write (for example)
__all__ = 'this that other'.split()
string_list = 'evenOneWord'.split()
instead of
__all__ = 'this','that','imTiredOfMistypingCommasAndQuotes'
if not isinstance(o,set_of_handled_types):
raise TypeError('call blessed programmer, this cannot occur')
if isinstance(o,set_of_handle_types-treat_differently):
treat_thusly(o)
elif isinstance(o,treat_differently):
treat_differently(o)
elif etc.
More information about the Python-list
mailing list