On Sun, Apr 12, 2015 at 6:04 AM, Chris Angelico <ros...@gmail.com> wrote: > On Sun, Apr 12, 2015 at 4:49 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Apr 11, 2015 5:06 AM, "Steven D'Aprano" >> <steve+comp.lang.pyt...@pearwood.info> wrote: >>> >>> Yes, I agree that Python's behaviour here is better than the alternative. >>> Having "except ()" catch nothing is consistent with the behaviour with >>> other tuples, so I'm okay with that. But it still surprised me :-) >> >> There's another alternative that I haven't seen suggested yet. An empty >> tuple could be considered an indication of a programming error and raise a >> chained ValueError. > > Not really a lot of point. Just as with isinstance, an empty tuple > simply matches nothing. Why go to the effort of rejecting it?
(At least, I assume you're not putting a literal empty tuple in. This would be useful only in cases where the tuple is provided dynamically.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list