"m g william" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
<snip>
> #now replace all 'rng's with consecutive streams
> #===============================================
> def static_num():
>    ''' this is a generator function that avoids globals
> yield differentiates fn as generator fn which freezes
> '''
>    x = 0
>    while True:
>       x += 1
>       yield str(x)
>
> static = static_num().next

Also, check out itertools.count (one of many tools from the excellent 
itertools module), as in:

    static - itertools.count().next

- no need to roll this function for yourself.  You still need to call it for 
each substitution, though, as described elsewhere.

-- Paul 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to