Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11987
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") |
| Date | 2011-08-21 22:15 -0400 |
| References | <8c606fc1-0aa8-4113-b607-e46ad6f3d649@glegroupsg2000goo.googlegroups.com> <pan.2011.08.21.21.07.55.886000@nowhere.com> <62dbc2b2-36bd-420c-a5f5-3a6aefcdc139@glegroupsg2000goo.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.298.1313979609.27778.python-list@python.org> (permalink) |
On 8/21/2011 7:49 PM, Laurent Payot wrote: > I made Python my language of choice because of its readability and > simpleness, and not because of its speed. But it's always good to > know what is the fastest sometimes when you don't want to write a > module in C. So I was just wondering if there was a difference. There > is, of a few percent. Anyway I will keep on using the 2% slower "i += > 1" because for me that's less prone to errors because you write the > variable only once, and that's more important than speed. For longer variable names, it is also easier and faster to read once one gets used to the idiom. number_of_chars += 1 # versus number_of_chars = number_of_chars + 1 Not repeating was a major reason for the addition. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Laurent <laurent.payot@gmail.com> - 2011-08-21 09:52 -0700
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") woooee <woooee@gmail.com> - 2011-08-21 09:59 -0700
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Laurent <laurent.payot@gmail.com> - 2011-08-21 10:03 -0700
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Irmen de Jong <irmen@-NOSPAM-xs4all.nl> - 2011-08-21 19:14 +0200
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Hans Mulder <hansmu@xs4all.nl> - 2011-08-21 19:57 +0200
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Nobody <nobody@nowhere.com> - 2011-08-21 22:07 +0100
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Laurent Payot <laurent.payot@gmail.com> - 2011-08-21 16:49 -0700
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Terry Reedy <tjreedy@udel.edu> - 2011-08-21 22:15 -0400
Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Terry Reedy <tjreedy@udel.edu> - 2011-08-21 20:35 -0400
csiph-web