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