On Mon, 15 Jun 2009 15:35:04 -0400 Terry Reedy <[email protected]> wrote:
> Christian Heimes wrote:
> > Terry Reedy wrote:
> >> You did not specify version. In Python3, os.walk has become a generater
> >> function. So, to answer your question, use 3.1.
> >
> > I'm sorry to inform you that Python 3.x still returns a list, not a
> > generator.
>
> >>> type(os.walk('.'))
> <class 'generator'>
>
> However, it is a generator of directory tuples that include a filename
> list produced by listdir, rather than a generator of filenames
> themselves, as I was thinking. I wish listdir had been changed in 3.0
> along with map, filter, and range, but I made no effort and hence cannot
> complain.
Why? We have itertools.imap, itertools.ifilter and xrange already.
--
Mike Kazantsev // fraggod.net
signature.asc
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list
