python - Exception signature -


what's signature class exception in python 2.x?

i wish subclass , add arguments of own, while correctly invoking super.

the following code works:

class fooerror(exception):     def __init__(self, msg, x):         super(fooerror, self).__init__(msg)         self.x = x 

but, there documentation or reference? pydoc exception not helpful. neither documentation: this or this.

what have there fine. alternately,

class fooerror(exception):     def __init__(self, msg, x):         exception.__init__(self,msg)         self.x = x 

as docs:

an overriding method in derived class may in fact want extend rather replace base class method of same name. there simple way call base class method directly: call baseclassname.methodname(self, arguments). useful clients well. (note works if base class accessible baseclassname in global scope.)


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -