Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51147
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.05; 'subject:Python': 0.06; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'iterate': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'skip:/ 10': 0.09; 'subject:()': 0.09; 'wrapped': 0.09; '~ethan~': 0.09; 'python': 0.11; 'itself.': 0.14; '24,': 0.16; 'benjamin': 0.16; 'dict': 0.16; 'iterated': 0.16; 'once.': 0.16; 'set,': 0.16; 'wrote:': 0.18; 'appears': 0.22; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'looks': 0.24; '(or': 0.24; 'question': 0.24; 'header :In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; '3.x': 0.31; 'used,': 0.33; 'could': 0.34; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'so,': 0.37; 'list': 0.37; 'same.': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'even': 0.60; 'identify': 0.61; 'new': 0.61; 'received:173': 0.61; 'different': 0.65; 'temporary': 0.65; 'received:69.56': 0.68; 'subject: & ': 0.68; 'jul': 0.74; '7:25': 0.84; 'dict,': 0.84; 'ethan': 0.84; 'furman': 0.84; 'oscar': 0.84; 'received:gateway02.websitewelcome.com': 0.91; '2013': 0.98 |
| Date | Wed, 24 Jul 2013 08:57:11 -0700 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Python 3: dict & dict.keys() |
| References | <51EF2AD8.3080105@stoneleaf.us> <ksnrr9$k4t$1@ger.gmane.org> <CAHVvXxQGCFJe7ud+mwh4zhnq5F7xvHJX1pCtGCjMaFtjBwY=iQ@mail.gmail.com> |
| In-Reply-To | <CAHVvXxQGCFJe7ud+mwh4zhnq5F7xvHJX1pCtGCjMaFtjBwY=iQ@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator410.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-BWhitelist | no |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | ([173.12.184.233]) [173.12.184.233]:44846 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 1 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.5049.1374682931.3114.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1374682931 news.xs4all.nl 15937 [2001:888:2000:d::a6]:38752 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:51147 |
Show key headers only | View raw
On 07/24/2013 05:51 AM, Oscar Benjamin wrote: > > On Jul 24, 2013 7:25 AM, "Peter Otten" <__peter__@web.de <mailto: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,...)? You wouldn't. But you don't need .keys() for that either as you can just use the dict itself. My point is that in 2.x .keys() did something different from the dict, while in 3.x it appears to me that they are the same. Peter's point is that in the stdlib the new functionality of .keys() is never used, not even once. -- ~Ethan~
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Python 3: dict & dict.keys() Ethan Furman <ethan@stoneleaf.us> - 2013-07-24 08:57 -0700
Re: Python 3: dict & dict.keys() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-25 05:48 +0000
Re: Python 3: dict & dict.keys() Chris Angelico <rosuav@gmail.com> - 2013-07-25 16:02 +1000
Re: Python 3: dict & dict.keys() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-25 07:27 +0000
Re: Python 3: dict & dict.keys() Chris Angelico <rosuav@gmail.com> - 2013-07-25 18:15 +1000
Re: Python 3: dict & dict.keys() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-25 09:44 +0000
Re: Python 3: dict & dict.keys() Chris Angelico <rosuav@gmail.com> - 2013-07-25 20:34 +1000
Re: Python 3: dict & dict.keys() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-25 14:57 +0000
Re: Python 3: dict & dict.keys() Chris Angelico <rosuav@gmail.com> - 2013-07-26 01:07 +1000
Re: Python 3: dict & dict.keys() Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-07-25 15:22 +0200
Re: Python 3: dict & dict.keys() Ethan Furman <ethan@stoneleaf.us> - 2013-07-25 06:57 -0700
csiph-web