question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proliferation of states

See original GitHub issue

With the coffee machine example in the readme, we go from 3 state attributes (beans, water, lid), to just one (beans), to make the following examples simpler. I’m a little confused about the complex case though. It seems like with n independent boolean state attributes, you need 2^n automat states, as well as appropriate upons . So for the coffee machine example:

@_machine.state(initial=True)
def no_beans_no_water_open_lid(self):
    pass
@_machine.state()
def no_beans_water_open_lid(self):
    pass
@_machine.state()
def no_beans_no_water_closed_lid(self):
    pass
@_machine.state()
def no_beans_water_closed_lid(self):
    pass
@_machine.state()
def beans_no_water_open_lid(self):
    pass
@_machine.state()
def beans_water_open_lid(self):
    pass
@_machine.state()
def beans_no_water_closed_lid(self):
    pass
@_machine.state()
def beans_water_closed_lid(self):
    pass

Or am I just thinking about this completely wrong?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
fmoorcommented, Sep 25, 2017

Sure. I’ll give it a go.

0reactions
glyphcommented, Sep 24, 2017

Minor quibble: I’d want to call it machine.flag, but otherwise this definitely looks interesting. I can’t say for sure I’d accept it without looking at more examples, but would you be willing to implement a proof of concept in a PR so some people can play with it and see if it addresses the use-case well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The proliferation of states
The Proliferation of States. Not without reason, the world has been worrying about the prolif- eration of nuclear, biological, and chemical weapons, ...
Read more >
When Did (and Didn't) States Proliferate? - Belfer Center
Proliferation refers to a spectrum of possible activities related to the exploration, pursuit, or acquisition of nuclear weapons by states.
Read more >
Strategies of Nuclear Proliferation: How States Pursue the Bomb
Four strategies of proliferation are available to states: hedging, sprinting, hiding, and sheltered pursuit. Nuclear acquisition theory explains why a ...
Read more >
Why Do States Build Nuclear Weapons? - JSTOR
relations scholars have a clear and simple answer to the proliferation puzzle: states will seek to develop nuclear weapons when they face a...
Read more >
Treaty on the Non-Proliferation of Nuclear Weapons (NPT)
A total of 191 States have joined the Treaty, including the five nuclear-weapon States. More countries have ratified the NPT than any other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found