On Wed, 14 Jan 2009 22:03:37 -0500, Lambert, David W (S&T) wrote:
> Overly terse. I do mean that this is illegal:
>
> isinstance(s, {str, bytes})
*shrug*
Just change the {} to () and it will work fine.
Or do this:
isinstance(s, tuple({str, bytes}))
> tuples have order, immutability, and the possibility of repeat items.
Yes. And why is this a problem?
> A set is most reasonable in a mathematical sense.
What is the benefit of using sets instead of tuples inside isinstance?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list