Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'explicitly': 0.05; 'subject:Python': 0.06; 'iterate': 0.09; 'skip:/ 10': 0.09; 'subject:()': 0.09; 'wrapped': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '24,': 0.16; 'iterated': 0.16; 'set,': 0.16; 'to:addr:web.de': 0.16; '\xa0what': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'looks': 0.24; '(or': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'could': 0.34; 'problem.': 0.35; 'received:google.com': 0.35; 'so,': 0.37; 'list': 0.37; 'either': 0.39; 'how': 0.40; 'identify': 0.61; 'different': 0.65; 'temporary': 0.65; 'subject: & ': 0.68; 'jul': 0.74; '7:25': 0.84; 'ethan': 0.84; 'furman': 0.84; 'oscar': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=oma/e9HjCrVox4K/rf5N00auu8evM7c8OjWHQu063Rc=; b=a5FHnkR6AvHvZ1IWP3WZOHIwkv47eEMAzZcuZbAquJhx/YtbY50S1QQ2Mo8srrH8PS OLXJjd9Y5BvV626E0G0vCwTH3Ypaipty0DRCja71IaWDngtRowhFyq4cnZglHXnL/0eH 6731jO8JNHrOQKTPgnMM3M3A+k82czbILLP5/700ODUjRSjHrSPiDft8PUPqsXC3WIyQ 1a2NVGow4z6TJNTPOISy2HFFUe7nj1xuuHIGtiPMrYjyT03j1MD85FqBgCnc4x3Y1rpa tg4XbcBO6IcgKNY22V4O2g2FfBb4/eksm/E8BNNlUB43WRvOi9ZtbkAseT6qOawKJdjm RRGw== MIME-Version: 1.0 X-Received: by 10.68.225.197 with SMTP id rm5mr42314327pbc.159.1374670294785; Wed, 24 Jul 2013 05:51:34 -0700 (PDT) In-Reply-To: References: <51EF2AD8.3080105@stoneleaf.us> Date: Wed, 24 Jul 2013 13:51:34 +0100 Subject: Re: Python 3: dict & dict.keys() From: Oscar Benjamin To: Peter Otten <__peter__@web.de> Content-Type: multipart/alternative; boundary=047d7b2e073b9aa32904e2415efc Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374670298 news.xs4all.nl 15998 [2001:888:2000:d::a6]:34695 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51127 --047d7b2e073b9aa32904e2415efc Content-Type: text/plain; charset=ISO-8859-1 On Jul 24, 2013 7:25 AM, "Peter Otten" <__peter__@web.de> wrote: > > Ethan Furman wrote: > > > So, my question boils down to: in Python 3 how is dict.keys() different > > from dict? What are the use cases? > > I just grepped through /usr/lib/python3, and could not identify a single > line where some_object.keys() wasn't either wrapped in a list (or set, > sorted, max) call, or iterated over. > > To me it looks like views are a solution waiting for a problem. What do you mean? Why would you want to create a temporary list just to iterate over it explicitly or implicitly (set, sorted, max,...)? Oscar --047d7b2e073b9aa32904e2415efc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Jul 24, 2013 7:25 AM, "Peter Otten" <__peter__@web.de> wrote:
>
> Ethan Furman wrote:
>
> > So, my question boils down to: =A0in Python 3 how is dict.keys() = different
> > from dict? =A0What are the use cases?
>
> I just grepped through /usr/lib/python3, and could not identify a sing= le
> line where some_object.keys() wasn't either wrapped in a list (or = set,
> sorted, max) call, or iterated over.
>
> To me it looks like views are a solution waiting for a problem.

What do you mean? Why would you want to create a temporary list just to = iterate over it explicitly or implicitly (set, sorted, max,...)?

Oscar

--047d7b2e073b9aa32904e2415efc--