Cortex  10.0.0-a4
Public Member Functions | List of all members
IECore.IgnoredExceptions Class Reference

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)
 

Detailed Description

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"]

Constructor & Destructor Documentation

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.


The documentation for this class was generated from the following file: