neulab / xnmt

eXtensible Neural Machine Translation
Other
185 stars 44 forks source link

@register_xnmt_event problems #570

Open philip30 opened 5 years ago

philip30 commented 5 years ago
class A:
    @register_xnmt_handler
    def __init__(self, a):
        self.a = a

class B(A):
    @register_xnmt_handler
    def __init__(self, a, b):
        super().__init__(a)
        self.b = b

    @handle_xnmt_event
    def on_f():
        self.b = 2 * self.b

# on_f on class B will be called twice, not sure if this is intended
f()