glyph / automat

Self-service finite-state machines for the programmer on the go.
MIT License
583 stars 64 forks source link

collector of `next` does not work #129

Closed cjw296 closed 3 years ago

cjw296 commented 3 years ago

These docs show a collector of next:

https://github.com/glyph/automat/blame/master/docs/about.rst#L427-L430

...but I don't believe that can ever work, I think it needs to be itemgetter(0).

Given the common use of "return the first result of the output methods", perhaps this could be added to automat/__init__.py:

from operator import itemgetter
first = itemgetter(0)

...and then, obviously, add it to __all__?

For the docs, perhaps Sybil could be used to test these examples to ensure they are functional and correct?

glyph commented 3 years ago

Thanks @cjw296 ! Want to make a pR?