[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] [PLEASE TEST]: New locking code



On, Wed Jun 11, 2008, Charlie Nolan wrote:

> Errors should never pass silently.
> Unless explicitly silenced.

It is - at least for me - no error, if I try to unlock a surface that a)
has no locks or b) is locked by something else. Instead I'd vote for a
return value, which indicates whether the unlock() call was successful
or not.

  if surface.unlock ():
      print "Unlock successful"
  ...

This let's us preserve backwards compatibility while letting the user
check for success through the return value without the need to write
extensive try: except: statements.

Regards
Marcus

Attachment: pgp1aOOaTNal4.pgp
Description: PGP signature