Attention is currently required from: dexter, laforge.
1 comment:
File pySim/global_platform.py:
Patch Set #1, Line 262: intermediate = False
Something that only exists in CardApplicationSD but not any derived classes.
This can be done by making `intermediate` private by renaming it to `__intermediate`.
This prefix makes fields and methods somewhat special:
```
class Parent:
# this field can be accessed as self.__intermediate by methods of this class,
# but not by methods of child classes and not from the outside
__intermediate = True
class Child(Parent):
pass
>>> Parent.__intermediate # yields AttributeError
>>> Child.__intermediate # yields AttributeError
>>> Parent._Parent__intermediate # True
>>> Child._Parent__intermediate # True
>>> Child._Child__intermediate # yields AttributeError
```
As can be seen, `Child` class still does inherit field `__intermediate`, but Python prepends the parent class name to it. So you can use this when iterating over the sub-classes of `CardApplication`:
```
if hasattr(app_cls, '_' + app_cls.__name__ + '__intermediate'):
continue # skip intermediate classes
```
See also: https://stackoverflow.com/questions/20261517/inheritance-of-private-and-protected-methods-in-python.
To view, visit change 35440. To unsubscribe, or for help writing mail filters, visit settings.