UniSize/s02190253
UniSize/Ushuaya
n1class Ctr:n1class Dsc:
2 
2    def __get__(self, obj, cls):3    def __get__(self, obj, cls):
nn4        #print(f"Get from {cls}:{obj}")
3        try:5        try:
4            return len(obj)6            return len(obj)
5        except BaseException:7        except BaseException:
6            try:8            try:
7                return abs(obj)9                return abs(obj)
8            except BaseException:10            except BaseException:
9                return 011                return 0
1012
1113
12def sizer(cls):14def sizer(cls):
n13    cls.size = Ctr()n15    cls.size = Dsc()
14    return cls16    return cls
1517
tt18# @sizer
19# class S(str):
20#     pass
21 
22# @sizer
23# class N(complex):
24#     pass
25 
26# @sizer
27# class E(Exception):
28#     pass
29 
30# for obj in S("QWER"), N(3+4j), E("Exceptions know no lengths!"):
31#     print(obj, obj.size)
32 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op