Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'example:': 0.03; 'elements.': 0.07; 'subject:changing': 0.07; 'container,': 0.16; 'remove.': 0.16; 'cc:addr:python-list': 0.17; 'header:In-Reply- To:1': 0.21; 'seems': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'structure': 0.23; 'message-id:@mail.gmail.com': 0.28; 'random': 0.28; 'subject:How': 0.30; 'cc:addr:python.org': 0.30; 'received:74.125.83.174': 0.35; 'received:mail- pv0-f174.google.com': 0.35; 'received:google.com': 0.37; 'element': 0.37; 'received:74.125': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'unique': 0.63; 'collection': 0.72; 'to:addr:nobody': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=/v6eeyfAfYiUp+4ev81wp2L0b0HzK8BCsppOxoAnE9s=; b=EH/em6ftJrv4QVjDoajgwdmvp9LsthgCZcNwPQAm1J2UCqhsPp8wXaoNbJjnvwkfMI Pxmg5R8Dn0666lq8i+Q2hq9kKx9Ktb42wSqXV1w46UBOMmEwlYeJFpQC7OjBARDxuieH 7g0jZBCckn8/KoyOkzWHEw1tc9jEX7jyE9GR4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=tr1GgwdVUS8boEppi80accRlpBCXrx/NpISZ9oz/khJBrGMdXST9VxjNcGc1nwTzzP wJ6cMuXfu4g2YDTKN+rb6oC5VJ55W45COJr3ZN6m00SriA1rETESu/taRm8NcBSs7Qvi ksTbZtBIyMgC4O/XAPWbEetWSWMq4Cyo/pwN0= MIME-Version: 1.0 In-Reply-To: References: <4dfe2b95$1@dnews.tpgi.com.au> Date: Mon, 20 Jun 2011 16:30:52 +0200 Subject: Re: How to iterate on a changing dictionary From: Florencio Cano To: TheSaint Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 9 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308580256 news.xs4all.nl 49045 [::ffff:82.94.164.166]:51420 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8015 > To make an example: imaging Bingo.Shuffle the numbers, each number sorted > should be removed from the container, how would it implemented? The structure seems a set -> unordered collection of unique elements. You can select a random element from the set with random.sample(container, num_of_elems) And then remove the elem from the set with remove.