Python 3 isinstance
MRAB
google at mrabarnett.plus.com
Thu Jan 15 08:56:57 EST 2009
Lambert, David W (S&T) wrote:
> Overly terse. I do mean that this is illegal:
>
> isinstance(s, {str, bytes})
>
> tuples have order, immutability, and the possibility of repeat items.
>
> A set is most reasonable in a mathematical sense.
>
You could say the same about s.startswith(("a", "b")).
It might be because sets are a more recent addition to the language; if
they had been in Python from the start then maybe they would've been
used instead.
More information about the Python-list
mailing list