[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Break outside the loop
On Nov 21, 2007 8:27 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> while 1:
> grid.update()
> try:
> explorer.next()
> except StopIteration:
> break
>
> By the way, "except StopIteration" can be replaced by just: "except",
> because there are no futher conditional "except"s.
Absolutely not. That would silently mask all errors that could happen
inside "next" leading to potentially hard to debug bugs. Empty
catch-all except-blocks should only be used in very rare cases where
you want to process all errors in the same way (e.g. some logging code
that the program root level).
--
Sami Hangaslammi