News for hackers. Stuff that matters.
Re:How I Learned to Stop Worrying and Love the State Machine by icebraining on Tuesday February 27, 2018 @02:56AM (#16471780)
Python already is a mainstream language:

    class Weapon: pass
    class Sword(Weapon): pass
    class Staff(Weapon): pass
    class Dagger(Weapon): pass

    class Player:
        weapon: Weapon
    class Wizard(Player):
        weapon: Optional[Union[Dagger, Staff]] = None
    class Warrior(Player):
        weapon: Optional[Union[Dagger, Sword]] = Sword()

There are no comments on this comment yet.