Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88840
| References | <d1e58c04-9c96-4fb8-a9ce-f56b9cdcd273@googlegroups.com> <mailman.217.1428744459.12925.python-list@python.org> <5528feec$0$13002$c3e8da3$5496439d@news.astraweb.com> <CALwzid=_R=zVJYpAJRemGS2j1PQsRY1_1TJjB8xW-rHgDkD-DQ@mail.gmail.com> <CAPTjJmrjJY+=kT7jo4sseCAC9+E1=nSGRv3T6jQY7XoWTRRVdw@mail.gmail.com> |
|---|---|
| Date | 2015-04-12 06:05 +1000 |
| Subject | Re: try..except with empty exceptions |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.230.1428782737.12925.python-list@python.org> (permalink) |
On Sun, Apr 12, 2015 at 6:04 AM, Chris Angelico <rosuav@gmail.com> wrote: > On Sun, Apr 12, 2015 at 4:49 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: >> On Apr 11, 2015 5:06 AM, "Steven D'Aprano" >> <steve+comp.lang.python@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
try..except with empty exceptions Pavel S <pavel@schon.cz> - 2015-04-10 01:48 -0700
Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-10 18:58 +1000
Re: try..except with empty exceptions sohcahtoa82@gmail.com - 2015-04-10 12:31 -0700
Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 11:42 +1000
Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 22:23 -0400
Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 19:38 -0700
Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 23:46 -0400
Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 21:17 -0700
Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 21:39 -0700
Re: try..except with empty exceptions Cameron Simpson <cs@zip.com.au> - 2015-04-11 19:27 +1000
Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 21:00 +1000
Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-11 21:21 +1000
Re: try..except with empty exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-11 12:49 -0600
Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-12 06:04 +1000
Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-12 06:05 +1000
Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 17:11 +1000
Re: try..except with empty exceptions Serhiy Storchaka <storchaka@gmail.com> - 2015-04-11 11:22 +0300
Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 20:47 +1000
Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-11 06:14 -0400
Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-11 06:24 -0400
Re: try..except with empty exceptions Ian Foote <ian@feete.org> - 2015-04-11 15:20 +0100
Re: try..except with empty exceptions Terry Reedy <tjreedy@udel.edu> - 2015-04-11 04:58 -0400
Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 16:27 -0400
Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 18:56 -0700
csiph-web