CountFields/hedayra | CountFields/SaurinK | ||||
---|---|---|---|---|---|
n | 1 | def fcounter(C, *params): | n | 1 | def fcounter(C, *args): |
2 | obj = C(*params) | 2 | obj = C(*args) | ||
3 | cm, cf, om, of = [], [], [], [] | 3 | cf, cm, of, om = [], [], [], [] | ||
4 | # f = field, m = method | ||||
5 | methods = dir(C) | ||||
6 | for m in methods: | ||||
7 | if m[0] != '_': | ||||
8 | if callable(getattr(C, m)): | ||||
9 | cm.append(m) | ||||
10 | else: | ||||
11 | cf.append(m) | ||||
4 | 12 | ||||
n | 5 | fields = dir(C) | n | 13 | methods = dir(obj) |
6 | for f in fields: | 14 | for m in methods: | ||
7 | if f[0] != '_': | 15 | if m[0] != '_': | ||
8 | if callable(getattr(C, f)): | 16 | if callable(getattr(obj, m)): | ||
17 | if m not in cm: | ||||
9 | cm.append(f) | 18 | om.append(m) | ||
10 | else: | 19 | else: | ||
t | 11 | cf.append(f) | t | ||
12 | |||||
13 | fields = dir(obj) | ||||
14 | for f in fields: | ||||
15 | if f[0] != '_': | ||||
16 | if callable(getattr(obj, f)): | ||||
17 | if f not in cm: | ||||
18 | om.append(f) | ||||
19 | else: | ||||
20 | if f not in cf: | 20 | if m not in cf: | ||
21 | of.append(f) | 21 | of.append(m) | ||
22 | |||||
23 | return cm, cf, om, of | 22 | return cm, cf, om, of | ||
24 | 23 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|