• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 21st, 2023

help-circle



  • Ugh, a Magic String (I call it that whatever the type)

    FACILITY_MAX_PRESSURES = {
        "Durham": 1000,
        "Ipswich": 500,
        "Calne": 750,
    }
    
    max_pressure = list(sorted(
        FACILITY_MAX_PRESSURES.values()
    ))[-1]
    
    if water_pressure > max_pressure:
        blah
    

    Obviously it should really pull from facility management, but that’s a bunch of moving parts where a constant is how you’d prefer the code to work

    Tbh it starts to look better to just define a constant and comment it.