Douglas Alan <[EMAIL PROTECTED]> writes: >>> The downside is that they are not quite as flexible as iterators >>> (which can be hard to code) and generators, which are slow. > >> Why do you think generators are any slower than hand-coded iterators? > > Generators aren't slower than hand-coded iterators in *Python*, but > that's because Python is a slow language.
But then it should be slow for both generators and iterators. > *Perhaps* there would be some opportunities for more optimization if > they had used a less general mechanism.) Or if the generators were built into the language and directly supported by the compiler. In some cases implementing a feature is *not* a simple case of writing a macro, even in Lisp. Generators may well be one such case. -- http://mail.python.org/mailman/listinfo/python-list