Conditions | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | |||
5 | def StarTuple(name, named_fields, elements): |
||
6 | named_tuple = collections.namedtuple(name, named_fields) |
||
7 | |||
8 | def this_pack(self): |
||
9 | packed = bytes() |
||
10 | for key, value in self.__elements.items(): |
||
11 | packed += value.pack(self._asdict()) |
||
12 | |||
13 | return packed |
||
14 | |||
15 | named_tuple.pack = this_pack |
||
16 | named_tuple.__elements = elements |
||
17 | |||
18 | return named_tuple |
||
19 |
Prefixing a member variable
_
is usually regarded as the equivalent of declaring it with protected visibility that exists in other languages. Consequentially, such a member should only be accessed from the same class or a child class: