On Tue, Mar 11, 2008 at 11:52:00PM +0530, rahul wrote:

>     try:
>          if args[0] in ("file", "license"):
>                  action = pkg.actions.fromlist(args[0], args[2:])
>                  def opener():
>                          return open(args[1])
>                  action.data = opener
>          else:
>                  action = pkg.actions.fromlist(args[0], args[1:])
> 
>      except ValueError, e:
>           print >> sys.stderr, e[0]
>           sys.exit(1)

I wanted to keep the try block as tight as possible, so that if other code
snuck in there that raised a ValueError, I wouldn't suppress it by
accident.  I could create a new exception class (MalformedActionError or
something), but that seemed like overkill.

Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to