CountFields/Bangod
CountFields/MaltsevAN
n1def fcounter(class_name, *args):n1def fcounter(object, *args):
2    cm = [field for field in dir(class_name) if2    method_list = [func for func in dir(object) if callable(
3          callable(getattr(class_name, field)) and not field.startswith('_')]3        getattr(object, func)) and not func.startswith('_')]
4 4    fields_list = [func for func in dir(object) if not callable(
5        getattr(object, func)) and not func.startswith('_')]
6    class_instance = object(*args)
7    instance_method_list = [
8        func for func in dir(class_instance) if callable(
9            getattr(
10                class_instance,
11                func)) and not func.startswith('_') and func not in method_list]
12    instance_fields_list = [
5    cf = [field for field in dir(class_name) if not callable(13        func for func in dir(class_instance) if not callable(
6        getattr(class_name, field)) and not field.startswith('_')]14            getattr(
7 15                class_instance,
8    instance = class_name(*args)16                func)) and not func.startswith('_') and func not in fields_list]
9 17    return method_list, fields_list, instance_method_list, instance_fields_list
10    om = [field for field in dir(instance) if
11          callable(getattr(instance, field)) and
12          not field.startswith('_') and
13          field not in cm]
14 
15    of = [field for field in dir(instance) if
16          not callable(getattr(instance, field)) and
17          not field.startswith('_') and
18          field not in cf]
19 
20    return cm, cf, om, of
21 
2218
23# class C:19# class C:
24#     x, y, z = 1, 3, 520#     x, y, z = 1, 3, 5
n25 n21#
26#     def X(self): return self.x22#     def X(self): return self.x
27#     def Y(self): return self.y23#     def Y(self): return self.y
n28 n24#
29#     def __init__(self, dx, dy, dz):25#     def __init__(self, dx, dy, dz):
30#         self.x = dx26#         self.x = dx
31#         self.Y = dy27#         self.Y = dy
32#         self.Z = dz28#         self.Z = dz
t33 t29#
34 
35# cm, cf, om, of = fcounter(C, 6, 7, 8)30# cm, cf, om, of = fcounter(C, 6, 7, 8)
36# print("Class: methods", *cm)31# print("Class: methods", *cm)
37# print("Class: fields", *cf)32# print("Class: fields", *cf)
38# print("Object: methods", *om)33# print("Object: methods", *om)
39# print("Object: fields", *of)34# print("Object: fields", *of)
4035
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op