relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

Terry Reedy tjreedy at udel.edu
Sun Aug 21 22:11:46 EDT 2011


On 8/21/2011 7:41 PM, Chris Angelico wrote:

> Agreed. If Python needed a faster alternative to "a=a+1", then I would
> recommend an "a.inc()" call or something

But looking up the method name, creating a bound method wrapper, and 
making the call would probably be slower than the syntax;-).

-- 
Terry Jan Reedy




More information about the Python-list mailing list