Gareth Rees added the comment:

Couldn't the test case use something like this to avoid allocating so much 
memory?

    from collections.abc import Sequence

    class RepeatedSequence(Sequence):
        """Immutable sequence of n repeats of elem."""
        def __init__(self, elem, n):
            self.elem = elem
            self.n = n

        def __getitem__(self, key):
            return self.elem

        def __len__(self):
            return self.n

and then:

    self.gen.choices(range(n), RepeatedSequence(1, n), k=10000)

----------
nosy: +Gareth.Rees

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28743>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to