News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

Charming Python: Generator-based state machines [developerWorks]

Jul 22, 2002 — by LinuxDevices Staff — from the LinuxDevices Archive — views

This article at IBM's developerWorks website demonstrates how to use Python's new generators to simplify state machines and simulate coroutines. It also shows additional patterns for the use of generators, in hopes of bringing readers further into the mindset of 'resumable functions'. If generators are new to you, you should first review the introduction to simple generators. There are many benefits to using simple generators. In addition to offering more natural ways of expressing the flow of a class of problems, generators can dramatically improve many inefficiencies.

Read full story

 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.