• Kirill Smelkov's avatar
    golang: Add support for @func(Class) and @func to be used over @property · 91a434d5
    Kirill Smelkov authored
    Since the beginning of pygolang it is possible to define methods
    separate from class. For example
    
        @func(MyClass)
        def my_method(self, ...):
            ...
    
    will define MyClass.my_method(*). This works for regular functions and
    staticmethod/classmethod as well. But support for properties was missing
    because there was no use case so far.
    
    -> Add support for properties as well as I hit the need for it during my
    work on wendelin.core monitoring.
    
    Test class changed to inherit from object since on py2 properties work
    only for new-style classes.
    
    (*) see afa46cf5 (Turn pygopath into full pygolang) and 942ee900
        (golang: Deprecate @method(cls) in favour of @func(cls)) for details.
    
    /reviewed-by @levin.zimmermann
    /reviewed-on nexedi/pygolang!31
    91a434d5
__init__.py 14.8 KB