Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95499
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| 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; 'empty,': 0.09; 'stored': 0.10; 'python.': 0.11; 'dictionary,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'wrote:': 0.16; 'say,': 0.18; 'skip': 0.18; 'work,': 0.21; 'not,': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'checking': 0.27; 'comparison': 0.29; 'dictionary': 0.29; 'certainly': 0.30; 'so,': 0.35; "isn't": 0.35; 'but': 0.36; 'instead': 0.36; '(and': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'your': 0.60; 'idiomatic': 0.84; 'subject:Check': 0.95 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=CvRCCSMD c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=Yo2XpZhZnQAA:10 a=IkcTkHD0fZMA:10 a=Li3kyu0WFEut7p6wBOcA:9 a=QEXdDO2ut3YA:10 a=4Z7X2_IusxAA:10 |
| X-AUTH | mrabarnett@:2500 |
| Subject | Re: Check if dictionary empty with == {} |
| To | python-list@python.org |
| References | <af138426-3eb4-4b72-aa0f-45ce7fc5c292@googlegroups.com> <CANc-5Uwh0btx9xN-7taooLv108KgYnYF-SJFMiHvGzPPM0oz4A@mail.gmail.com> |
| From | MRAB <python@mrabarnett.plus.com> |
| Date | Thu, 20 Aug 2015 00:33:49 +0100 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| MIME-Version | 1.0 |
| In-Reply-To | <CANc-5Uwh0btx9xN-7taooLv108KgYnYF-SJFMiHvGzPPM0oz4A@mail.gmail.com> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18.1440027240.28100.python-list@python.org> (permalink) |
| Lines | 11 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1440027240 news.xs4all.nl 23868 [2001:888:2000:d::a6]:56852 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95499 |
Show key headers only | View raw
On 2015-08-20 00:15, Skip Montanaro wrote:
> Comparison against {} will be less efficient. You need to create a
> dictionary every time instead of just checking the length of your
> dictionary, which is likely stored in the header. So, it will work, but
> certainly isn't idiomatic Python.
>
Well, that depends on the intention.
Is it checking whether the dictionary is empty, or whether it's an
empty dictionary (and not, say, an empty list)?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Check if dictionary empty with == {} Anton <anschatten@gmail.com> - 2015-08-19 15:57 -0700
Re: Check if dictionary empty with == {} MRAB <python@mrabarnett.plus.com> - 2015-08-20 00:33 +0100
Re: Check if dictionary empty with == {} Tim Chase <python.list@tim.thechases.com> - 2015-08-19 18:21 -0500
Re: Check if dictionary empty with == {} Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-08-20 13:16 +1000
Re: Check if dictionary empty with == {} Steven D'Aprano <steve@pearwood.info> - 2015-08-21 03:44 +1000
Re: Check if dictionary empty with == {} Laurent Pointal <laurent.pointal@free.fr> - 2015-08-20 17:56 +0200
csiph-web