[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] pythonpoint pre^10-alpha 2 available

On Thu, Jun 21, 2001 at 10:40:33AM +0300, Jan Ekholm wrote:
> >the options here are:
> >
> >let toggle_fullscreen() fail silently like it currently does
> >(not to good really)
> Maybe return a value? 1 if ok, 0 if failed.

Error codes are a Bad Thing. Exceptions are better suited.

> >have toggle_fullscreen() raise an exception on failure
> >(better, at least)
> That would mean all calls need to be wrapped in try-excepts in order to
> avoid a nice trace...

That's how Python works. It's no worse visually than
if toggle_fullscreen() == 0:
    print "eek"
and it makes more logical sense. (ie, 'Try to toggle fullscreen, if there's an
exception print "eek"', instead of 'if the return value of toggle_fullscreen
is 0, which means error, print "eek"'.)

Chris Armstrong                        carmstro@twistedmatrix.com
http://twistedmatrix.com/~carmstro     carmstro@dynup.net
pygame mailing list