need help on generator...
francis.girard at free.fr
Fri Jan 21 17:54:47 CET 2005
I immediately download version 2.4, switching from version 2.3.
Le vendredi 21 Janvier 2005 17:34, Craig Ringer a écrit :
> On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote:
> > First, I think that you mean :
> > consecutive_sets = [ x[offset:offset+subset_size]
> > for subset_size in xrange(2, len(x))
> > for offset in xrange(0, len(x) + 1 - subset_size)]
> > (with square brackets).
> > I'm just trying to understand and obviously I'm missing the point.
> Yep. This:
> ( x for x in xrange(10) )
> will return a generator that calculates things as it goes, while this:
> [ x for x in xrange(10) ]
> will return a list.
> Check out:
> for details.
> Craig Ringer
More information about the Python-list