Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7606
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news.mixmin.net!.POSTED.2a01:4f8:100:5243::4!not-for-mail |
|---|---|
| From | Steve Crook <steve@mixmin.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: Dictionaries and incrementing keys |
| Date | Tue, 14 Jun 2011 12:53:11 +0000 (UTC) |
| Organization | Mixmin |
| Message-ID | <slrnivemdn.47d.steve@news.mixmin.net> (permalink) |
| References | <slrnivefl8.47d.steve@news.mixmin.net> <it7fu4$rc5$1@solani.org> <078c5e9a-8fad-4d4c-b081-f69d0f57593d@v11g2000prk.googlegroups.com> |
| Injection-Date | Tue, 14 Jun 2011 12:53:11 +0000 (UTC) |
| Injection-Info | news.mixmin.net; posting-host="2a01:4f8:100:5243::4"; logging-data="32202"; mail-complaints-to="abuse@mixmin.net" |
| User-Agent | slrn/pre1.0.0-26 (Linux) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7606 |
Show key headers only | View raw
On Tue, 14 Jun 2011 05:37:45 -0700 (PDT), AlienBaby wrote in Message-Id: <078c5e9a-8fad-4d4c-b081-f69d0f57593d@v11g2000prk.googlegroups.com>: > How do those methods compare to the one I normally use; > > try: > dict[key]+=1 > except: > dict[key]=1 This is a lot slower in percentage terms. You should also qualify the exception: except KeyError
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Dictionaries and incrementing keys Steve Crook <steve@mixmin.net> - 2011-06-14 10:57 +0000
Re: Dictionaries and incrementing keys Peter Otten <__peter__@web.de> - 2011-06-14 13:16 +0200
Re: Dictionaries and incrementing keys AlienBaby <matt.j.warren@gmail.com> - 2011-06-14 05:37 -0700
Re: Dictionaries and incrementing keys Steve Crook <steve@mixmin.net> - 2011-06-14 12:53 +0000
Re: Dictionaries and incrementing keys Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-14 13:26 +0000
Re: Dictionaries and incrementing keys Steve Crook <steve@mixmin.net> - 2011-06-14 12:57 +0000
Re: Dictionaries and incrementing keys Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-14 13:24 +0000
Re: Dictionaries and incrementing keys Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-14 09:30 -0700
Re: Dictionaries and incrementing keys Raymond Hettinger <python@rcn.com> - 2011-06-25 01:13 -0700
csiph-web