AON LAZIO wrote:
I have come across this code and I tried to figure out what does it do
First, I do not understand the sign @... above the class method, what does it do? Second, about the object in AnyWrapper(object), why do they declare "object" as the superclass?
sometimes I saw (type) what the differences between "object" and "type"?

Object is the base class. Type is the base metaclass. Reread the class statement doc. @statements are decorators. I believe they are documented along with function statements, though in 3.0 they apply to classes also.


from ib.lib.overloading import overloaded

class AnyWrapper(object):
    @overloaded
    def error(self, e):
        raise NotImplementedError()
    @error.register(object, str)
    def error_0(self, strval):
        raise NotImplementedError()

Thanks in advance

Aonlazio


------------------------------------------------------------------------

--
http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to