UniSize/Ushuaya
UniSize/s02190253
n1class Dsc:n1class Ctr:
2 
3    def __get__(self, obj, cls):2    def __get__(self, obj, cls):
n4        #print(f"Get from {cls}:{obj}")n
5        try:3        try:
6            return len(obj)4            return len(obj)
7        except BaseException:5        except BaseException:
8            try:6            try:
9                return abs(obj)7                return abs(obj)
10            except BaseException:8            except BaseException:
11                return 09                return 0
1210
1311
14def sizer(cls):12def sizer(cls):
n15    cls.size = Dsc()n13    cls.size = Ctr()
16    return cls14    return cls
1715
t18# @sizert
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