Jun-18-2019, 05:43 AM
(This post was last modified: Jun-18-2019, 05:43 AM by Gribouillis.)
Skaperen Wrote:why not a list?Because you want to choose the logic according to arriving code value
logic = { 'a': self.a_logic, 'b': self.b_logic, ... } ... for c in line: logic.get(c, default)() # <-- This replaces the sequence of elifs