A question about generators
Richard J. Kuhns
rjk at grauel.com
Fri Mar 22 13:28:48 EST 2002
Greg Ewing <greg at cosc.canterbury.ac.nz> writes:
> Richard J Kuhns wrote:
> >
> > That's EXACTLY what I did :). The main reason I had problems to start with
> > is that almost everything I've done with python feels more-or-less
> > "elegant", and this doesn't.
>
> Well, generators weren't designed for the sort of problems
> that require restartability.
>
> Is there some reason you absolutely can't just create
> a new instance of the generator each time you need
> to restart? That would be the most elegant way,
> if you can manage it.
>
No, there's no reason I couldn't create a new instance each time. I'd
started out trying to find a simple way to implement something that's only
rarely going to be used in this particular app, and it turned out to be
hairier than I'd expected. After I get this app running I'll probably
revisit it, but since it *is* working right now... You know, `good enough'
is the enemy of `the best'.
--
Richard Kuhns rjk at grauel.com
PO Box 6249 Tel: (765)477-6000 \
100 Sawmill Road x319
Lafayette, IN 47903 (800)489-4891 /
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With NINE Servers In California And Texas - The Worlds Uncensored News Source
More information about the Python-list
mailing list