Lichen

tests/attr_class.py

1027:dd0745ab8b8a
5 months ago Paul Boddie Reordered GCC arguments to prevent linking failures. Someone decided to change the GCC invocation or linking semantics at some point, meaning that libraries specified "too early" in the argument list no longer provide the symbols required by the program objects, whereas specifying them at the end of the argument list allows those symbols to be found and obtained.
     1 class SignalState:     2     Red = 1     3     Amber = 2     4     Green = 3     5     AmberAgain = 4     6     Off = None     7      8 class Signal:     9     def __init__(self):    10         self.disable()    11     12     def enable(self):    13         self.state = SignalState.Red    14     15     def disable(self):    16         self.state = SignalState.Off    17     18     def next(self):    19         if self.state == SignalState.Red:    20             self.state = SignalState.Amber    21         elif self.state == SignalState.Amber:    22             self.state = SignalState.Green    23         elif self.state == SignalState.Green:    24             self.state = SignalState.AmberAgain    25         elif self.state == SignalState.AmberAgain:    26             self.state = SignalState.Red    27         else:    28             self.state = SignalState.Off    29     30 s = Signal()    31 print s.state   # None    32 s.next()    33 print s.state   # None    34 s.enable()    35 print s.state   # 1    36 s.next()    37 print s.state   # 2    38 s.next()    39 print s.state   # 3    40 s.next()    41 print s.state   # 4    42 s.next()    43 print s.state   # 1