[Twisted-Python] automat question

Glyph glyph at twistedmatrix.com
Mon Mar 15 03:34:23 MDT 2021



> On Mar 15, 2021, at 1:18 AM, Chris Withers <chris at withers.org> wrote:
> 
> On 09/03/2021 18:53, Glyph wrote:
>>> On Mar 9, 2021, at 3:18 AM, Chris Withers <chris at withers.org <mailto:chris at withers.org>> wrote:
>>> 
>>> I'm not sure we're quite on the same page: I'm not looking to inspect the state, but more be notified when certain edges are traversed.
>> The way you get notified when an edge is traversed is you add an output to that edge :).
> 
> Right, but as best I can tell, outputs in automat have to be defined as part of the state machine class, I need targets only available after class instantiation to be notified.

Outputs are just methods, so it sort of depends what you mean by "after class instantiation".  You can call whatever you want in an output.

>> Again... have outputs.  I think there's something you're leaving out about how you want to have some /generalized/ output, but without knowing a bit more it's hard to say how it could help more :).
> 
> I think it's what I said above. TBH, I'm probably going to end up writing "yet another state machine class" that does just what I need, but I think that's okay - not everything has to work for every situation :-)

It sounds like what you might want here is soemthing for constructing arbitrary machines at runtime, and automat is all about enforcing that your machine is static so that (for example) it can be visualized statically.  So yeah in that case, different library.

-g
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20210315/2369f594/attachment.htm>


More information about the Twisted-Python mailing list