[Tutor] I am terribly confused about "generators" and "iterators".. Help me
Jonathon Sisson
sisson.j at gmail.com
Fri Oct 27 23:55:10 CEST 2006
My understanding is that an iterator is basically a facade` pattern. If
you aren't familiar with patterns, a facade` pattern basically makes
something really easy to use or convenient. Yes, you can "do it by
hand", and many times that is indeed the preferred method, but sometimes
it's easier to use an iterator...particularly if it isn't a special
case. Nothing in the manual says you HAVE to use iterators, but they
*can* make life easier.
Jonathon
Asrarahmed Kadri wrote:
>
>
> Hi Folks,
>
> What are generators and iterators...??And why are they are needed..??
>
> I can do my stuff with a 'for' or a 'while' loop.. so why do I need an
> ITERATOR..?
>
> And what is a generator ..? I did try to read about these two things on
> the web, but still I AM CONFUSED.
>
> To be honest, I am used to the nice and lucid style of the wonderful
> people on this forum.. :)-
>
> Regards,
> Asrarahmed Kadri
>
>
> --
> To HIM you shall return.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list