UniSize/bucholga | UniSize/soapun | ||||
---|---|---|---|---|---|
n | 1 | class SpecialClass: | n | 1 | class Sizer: |
2 | |||||
2 | def __get__(self, obj, cls): | 3 | def __get__(self, obj, cls): | ||
3 | if hasattr(obj, "__len__"): | 4 | if hasattr(obj, "__len__"): | ||
4 | return len(obj) | 5 | return len(obj) | ||
n | 5 | if hasattr(obj, "__abs__"): | n | 6 | elif hasattr(obj, "__abs__"): |
6 | return abs(obj) | 7 | return abs(obj) | ||
n | n | 8 | else: | ||
7 | return 0 | 9 | return 0 | ||
8 | 10 | ||||
9 | 11 | ||||
t | 10 | def sizer(p_class): | t | 12 | def sizer(cls): |
11 | p_class.size = SpecialClass() | 13 | cls.size = Sizer() | ||
12 | return p_class | 14 | return cls | ||
13 | 15 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|