[Twisted-Python] twisted and functional programming idioms
Drew Smathers
drew.smathers at gmail.com
Thu Jul 10 08:24:31 EDT 2008
On Wed, Jul 9, 2008 at 9:26 PM, Rodney D Price <rodprice at raytheon.com> wrote:
>
> I'm just getting started with Twisted, and trying to find
> my way around. I've done quite a bit of functional
> programming (Haskell), where recursion is a very
> common idiom. I keep finding myself heading in that
> direction as I try to understand how to use Twisted.
> For example, if I wanted to write a loop in Haskell
> that woke up once a second and did something, I
> might write
>
> main = heartbeat
> heartbeat = do
> sleep 1000
> doSomething
> heartbeat
>
Not related to the LoopingCall usage, but please heed Tristan's
warning on recursion: "Python doesn't handle lots of recursion very
well." You likely already know this, but there is no last call
optimization (aka tail recursion) in Python.
--
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/ \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\ /\\\ \\
/ /\\\ /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
d.p.s
More information about the Twisted-Python
mailing list