Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103756

Re: common mistakes in this simple program

From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Subject Re: common mistakes in this simple program
Date 2016-02-29 15:26 -0500
Message-ID <mailman.41.1456777585.20602.python-list@python.org> (permalink)
References (2 earlier) <CACT3xuXn1zCip-io9aQ_i0Av_tR-7AHbwq3bX2HbvdmyC_i9qA@mail.gmail.com> <CALwzidn8-HDrGSqZT2ODxhdNYL7yFt5hdmC8RnB4WC=gkD4Wtg@mail.gmail.com> <CACT3xuVxn+XuEa3xLNb+9wQ74cNWUZ8J3nmbkjKAtgq58gkLEg@mail.gmail.com> <CAPTjJmoASZBv9WKSHcSZM1CikzE0B=OJXVL1uHzNzdBmjF+uUQ@mail.gmail.com> <CACT3xuUoZ1+giS=6BaGGBkyJkZpuVw4DYMEw4-c4yhnM7U4DWg@mail.gmail.com>

Show all headers | View raw


On Mon, Feb 29, 2016 at 2:49 PM, Ganesh Pal <ganesh1pal@gmail.com> wrote:

> On Mar 1, 2016 12:06 AM, "Chris Angelico" <rosuav@gmail.com> wrote
> >
> > You're falling into the trap of assuming that the only exception you
> > can ever get is the one that you're planning for, and then handling.
>
> Ok sure !
>
> > ALL exceptions as though they were that one. Instead catch ONLY the
> > exception that you're expecting to see, and ignore everything else. Do
> > not use a bare "except:" clause, nor even "except Exception:", for
> > this. You will appreciate it later on.
>
> What option do I have now in  so ensure that I loop over the For loop. Try
> except is ruled out ?
>

Its not ruled out.  It is pointless.  Look at the documents.  Here is a
start: https://wiki.python.org/moin/HandlingExceptions

> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
http://cc-baseballstats.info/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: common mistakes in this simple program Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-29 15:26 -0500

csiph-web