Am 23.04.2013 06:00, schrieb Steven D'Aprano:
If it comes down to micro-optimizations to shave a few microseconds off,
consider using string % formatting rather than the format method.
Why? I don't see any obvious difference between the two...
Greetings!
Uli
--
On Tue, Apr 23, 2013 at 9:46 AM, Ulrich Eckhardt
ulrich.eckha...@dominolaser.com wrote:
Am 23.04.2013 06:00, schrieb Steven D'Aprano:
If it comes down to micro-optimizations to shave a few microseconds off,
consider using string % formatting rather than the format method.
Why? I don't see
On Tue, 23 Apr 2013 09:46:53 +0200, Ulrich Eckhardt wrote:
Am 23.04.2013 06:00, schrieb Steven D'Aprano:
If it comes down to micro-optimizations to shave a few microseconds
off, consider using string % formatting rather than the format method.
Why? I don't see any obvious difference between
On Wed, Apr 24, 2013 at 12:36 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
# Using Python 3.3.
py from timeit import Timer
py setup = a = 'spam'; b = 'ham'; c = 'eggs'
py t1 = Timer('%s, %s and %s for breakfast' % (a, b, c), setup)
py t2 = Timer('{}, {} and {} for
Am 23.04.2013 10:26, schrieb Chris “Kwpolska” Warrick:
On Tue, Apr 23, 2013 at 9:46 AM, Ulrich Eckhardt
ulrich.eckha...@dominolaser.com wrote:
Am 23.04.2013 06:00, schrieb Steven D'Aprano:
If it comes down to micro-optimizations to shave a few microseconds off,
consider using string %
Ulrich Eckhardt ulrich.eckha...@dominolaser.com writes:
So again, why is one faster than the other? What am I missing?
The .format() syntax is actually a function, and that alone carries some
overload. Even optimizing the lookup may give a little advantage:
from timeit import Timer
setup = a