Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Bernardo Sulzbach Newsgroups: comp.lang.python Subject: Re: subscripting Python 3 dicts/getting the only value in a Python 3 dict Date: Tue, 12 Jan 2016 15:18:01 -0200 Lines: 5 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de hc0X/bgg9eRQDzqHsZBe5AiljXTq5qqVJHO69V5q/7hw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.070 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.03; 'anyway.': 0.04; 'subject:Python': 0.05; 'subject:getting': 0.07; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'dictionary': 0.29; 'subject:/': 0.30; 'received:google.com': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'does': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'skip:n 10': 0.62; 'intentions': 0.84; 'subject:value': 0.84; 'trick.': 0.84; 'anymore,': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=tBBi7x11YN6mDDh4iM2Cor6AHo4EvLqaajlkPNTfI0w=; b=LZvsD/ncI2s8v1SaJj8KCMnNkp8rikVX1lgj8YSLRJyhRw99QzqsdINvi0DJGukHGg T/fApTLuaPr9W2/60WJj1hQ5b+d3tfLh2rD+r0ReRMDZA6yBmE80cktrGWTEpwfNQmg5 oDQe+Bm7zklwds09FFwp2p90Vr4DCT2mLe1ZNrETDmIdn9CWZ9I+S2vuAOBBey4qiWhD nLKHtQNt0q4rWUR7V/4xt/iQ4YanYHS5zJHDOgFwCFJHv5ldtAkeqYKKtDZMtM9leWZH u1ctNgqJshEVowF3Gs/lmy1do5NcT2sKQ5JBF0W7yHRa73cLbN6/y3ShLZ7DAPhPgsn7 ap4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=tBBi7x11YN6mDDh4iM2Cor6AHo4EvLqaajlkPNTfI0w=; b=BCGhT2hK5kDWvJBJJLSlphaNiZ4yipPPuKxTnU6ZBS7FYSTWgNVmmDYQjdne40J2+O vpX/dU6zsEmlQJaWljRJ/sdcPkX6xzlhYOBpQiaWavEkqBBsIxeXPTqC3fdPpP6k+jo2 1I/x5KmqS+/C7Py1L1BouRzJX7U0cmfcONK1U6EKEt3/pcOreGp8Q4ILOZuM7TKe4laB 7wIsllOfK5rdyvidMjCY11ARiz11Q6ofXnsMcPqhFgfQul0ZhFIzU8zDlGLMvbA5kQtZ 4Hc8znm/Vy04debhcQ7BXBQorvzezUwtRA7yPf+imDRQhEwuWPLQktnFOKbmUoXzFwBi 5UkA== X-Gm-Message-State: ALoCoQm3Mq3Wm4EulUcSazEotFjBf39A/FbwWgm3WBi4xwsvJiGPm4LbCQsdldiHW7bkAYFoe9taUHwtxRkLJaEF00lMeeYtJw== X-Received: by 10.25.141.129 with SMTP id p123mr24354596lfd.65.1452619120684; Tue, 12 Jan 2016 09:18:40 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101557 Intentions aside, next(iter(...)) seems the most pythonic you can get about this anyway. Just in case you happen not to need the dictionary anymore, d.popitem()[1] does the trick.