Nested loops is strangely slow, totally at a loss.

Chris Angelico rosuav at gmail.com
Wed Dec 10 01:53:05 EST 2014


On Wed, Dec 10, 2014 at 5:44 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> It would be nice if product iterators behaved like xrange() objects and
> could perform "in" tests without exhausting the iterator, but they don't.
> That's sad.

It'd be very difficult to do that in the general sense. But it should
be possible to have a multi-dimensional range object that behaves the
way Py3's range object does, including membership tests and stuff.
(Might already exist, for all I know.) That would do what the OP
wants, I think.

ChrisA



More information about the Python-list mailing list