UniSize/s02210059
UniSize/akozlov
f1def sizer(cls):f1def sizer(cls):
n2    class SizeGetter:n2 
3    class Descriptor:
4 
3        def __get__(self, obj, objtype=None):5        def __get__(self, obj, cls):
4            #print(obj, type(obj), dir(obj))6 
5            if hasattr(obj, "__len__"):7            if hasattr(obj, '__len__'):
6                return len(obj)8                return len(obj)
n7            elif hasattr(obj, "__abs__"):n9            if hasattr(obj, '__abs__'):
8                return abs(obj)10                return abs(obj)
n9            else:n
10                return 0
1111
t12    cls.size = SizeGetter()t12            return 0
13 
14    cls.size = Descriptor()
15 
13    return cls16    return cls
1417
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op