traceback (most recent call last)file ""line in syntaxerrorcouldn' parse configuration exception objects have _cause_ attributewhich is set to the previous exception use of the from qualifier with raise sets this attribute more subtle example of exception chaining involves exceptions raised within another exception handler for exampledef error(msg)print(mnotetypo is intentional ( undefinedtrystatements except valueerror as eerror("couldn' parse configuration"if you try this in python you only get an exception related to the nameerror in error(in python the previous exception being handled is chained with the result for exampleyou get this messagetraceback (most recent call last)file ""line in valueerrorinvalid literal for int(with base 'nineduring handling of the above exceptionanother exception occurredtraceback (most recent call last)file ""line in file ""line in error nameerrorglobal name 'mis not defined for implicit chainingthe _context_ attribute of an exception instance contains reference to previous exception improved super(the super(functionused to look up methods in base classescan be used without any arguments in python for exampleclass ( , )def bar(self)return super(bar(call bar(in bases in python you had to use super( ,selfbar(the old syntax is still supported but is significantly more clunky advanced metaclasses in python you can define metaclasses that alter the behavior of classes subtle facet of the implementation is that the processing carried out by metaclass only occurs after the body of class has executed that isthe interpreter executes the entire body of class and populates dictionary once the dictionary has been populatedthe dictionary is passed to the metaclass constructor (after the body of the class has executedin python metaclasses can additionally carry out extra work before the class body executes this is done by defining special class method called _prepare_ (clsnamebases**kwargsin the metaclass this method must return dictionary as lib fl ff