Cortex
10.0.0-a4
|
A context object intended for use with python's "with" syntax. More...
Public Member Functions | |
def | __init__ (self, args) |
Accepts a variable number of exception types - these will be silently ignored if they are thrown from within the body of the block. More... | |
def | __enter__ (self) |
def | __exit__ (self, type, value, traceBack) |
A context object intended for use with python's "with" syntax.
It is used to replace this idiom :
try : value = someThing["with"]["keys"]["that"]["may"]["not"]["exist"] except KeyError : pass
with something slightly more concise and expressive of what is happening :
with IgnoredExceptions( KeyError ) : value = someThing["with"]["keys"]["that"]["may"]["not"]["exist"]
def IECore.IgnoredExceptions.__init__ | ( | self, | |
args | |||
) |
Accepts a variable number of exception types - these will be silently ignored if they are thrown from within the body of the block.
References IECore.IgnoredExceptions.__toIgnore.