static keyword
Terry Reedy
tjreedy at udel.edu
Thu Apr 29 13:27:00 EDT 2004
"Rick Ratzel" <rick.ratzel at magma-da.com> wrote in message
news:40912de6$0$46516$39cecf19 at news.twtelecom.net...
> Robert beat me to it...I was going to reply with a generator
> example! Indeed...Nick *clearly* wants a generator. By far the most
> elegant IMO.
> Robert Brewer wrote:
> > Nick Jacobson wrote:
> > Bah. All these old fogies with their default arg hacks, when Nick
> > *clearly* wants a generator:
> >>>>def foo():
> > ... i = 10
> > ... print "First pass"
> > ... while True:
> > ... i += 1
> > ... yield i
> >
> >>>>g = foo()
> >>>>g.next()
> >
> > First pass
> > 11
Unless, of course, Nick's foo is a simplified illustrative example and he
wants 'static' effect in functions with parameters.
TJR
More information about the Python-list
mailing list