Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8015

Re: How to iterate on a changing dictionary

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 <florencio.cano@gmail.com>
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 <itnhfp$ab0$1@speranza.aioe.org>
References <itl1a5$rom$1@speranza.aioe.org> <4dfe2b95$1@dnews.tpgi.com.au> <itnhfp$ab0$1@speranza.aioe.org>
Date Mon, 20 Jun 2011 16:30:52 +0200
Subject Re: How to iterate on a changing dictionary
From Florencio Cano <florencio.cano@gmail.com>
To TheSaint <nobody@nowhere.net.no>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.182.1308580256.1164.python-list@python.org> (permalink)
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

Show key headers only | View raw


> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to iterate on a changing dictionary TheSaint <nobody@nowhere.net.no> - 2011-06-19 22:32 +0800
  Re: How to iterate on a changing dictionary Chris Angelico <rosuav@gmail.com> - 2011-06-20 01:13 +1000
    Re: How to iterate on a changing dictionary Roy Smith <roy@panix.com> - 2011-06-19 11:53 -0400
      Re: How to iterate on a changing dictionary Terry Reedy <tjreedy@udel.edu> - 2011-06-19 12:51 -0400
  Re: How to iterate on a changing dictionary Terry Reedy <tjreedy@udel.edu> - 2011-06-19 12:02 -0400
  Re: How to iterate on a changing dictionary Lie Ryan <lie.1296@gmail.com> - 2011-06-20 03:00 +1000
    Re: How to iterate on a changing dictionary TheSaint <nobody@nowhere.net.no> - 2011-06-20 21:20 +0800
      Re: How to iterate on a changing dictionary Florencio Cano <florencio.cano@gmail.com> - 2011-06-20 16:30 +0200
      Re: How to iterate on a changing dictionary Terry Reedy <tjreedy@udel.edu> - 2011-06-20 13:37 -0400
        Re: How to iterate on a changing dictionary TheSaint <nobody@nowhere.net.no> - 2011-06-21 18:44 +0800

csiph-web