This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author john.feuerstein
Recipients Julian, ezio.melotti, john.feuerstein, mark.dickinson, rhettinger
Date 2011-09-09.16:30:20
SpamBayes Score 8.2684154e-10
Marked as misclassified No
Message-id <1315585821.42.0.343084485466.issue12941@psf.upfronthosting.co.za>
In-reply-to
Content
> The test doesn't have to check that seq.pop() is working fine (there are other tests for that) but that it's actually called and that it pops the right element from the input sequence (and not e.g. from a copy of the sequence that might have been created at some point).

I agree, that makes sense.

> One use case I might think of is picking all the elements of a sequence until there are no more left, without risking to pick the same element twice.  The same result can be achieved by shuffling the sequence and iterate over the elements though (that doesn't actually leave you with an empty sequence, but that's probably just a unimportant side-effect).

One problem with shuffling in this use case is that you lose the otherwise original order of the remaining elements, so there is no way to return from "pop random elements" to "pop elements in order" (without working on a shallow copy). However, I would agree that this is rather uncommon.

Feel free to close this as "wont fix", after all it is trivial for the user to randomly pop elements out of a sequence himself (see above).

There might be other use cases. If nothing else, there's at least issue 12941 to reference now.

Thanks!
History
Date User Action Args
2011-09-09 16:30:21john.feuersteinsetrecipients: + john.feuerstein, rhettinger, mark.dickinson, ezio.melotti, Julian
2011-09-09 16:30:21john.feuersteinsetmessageid: <1315585821.42.0.343084485466.issue12941@psf.upfronthosting.co.za>
2011-09-09 16:30:20john.feuersteinlinkissue12941 messages
2011-09-09 16:30:20john.feuersteincreate