Maybe a stupid idea

Mark McEahern mark at
Wed Dec 31 20:10:44 CET 2003

On Wed, 2003-12-31 at 11:49, sebb wrote:
> I'm kind of newbie to programming, but I thought of something and I
> want some opinions on that.
> It's about a new instruction block to do some cycles.

Regarding the subject, I find it comforting to think that all ideas are
stupid.  Just like all questions are.  ;-)

Heh, I don't really know what you mean by cycle.  It'd be helpful to
know what problem you're trying to solve.  Anyway, consider this
admittedly pointless example:

#!/usr/bin/env python

import sys

def makecycle(doUp, doDown):
    def cycle(start, end):
        for i in range(start, end):
            yield i, doUp
        for i in range(end, start, -1):
            yield i, doDown
    return cycle

def doUp(i):

def doDown(i):

cycle = makecycle(doUp, doDown)
for i, func in cycle(1, 10):


// m

More information about the Python-list mailing list