This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients eric.araujo, ezio.melotti, mark.dickinson, serhiy.storchaka
Date 2013-04-28.07:40:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367134828.71.0.874509548552.issue17806@psf.upfronthosting.co.za>
In-reply-to
Content
Without patch:
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et()'
1000000 loops, best of 3: 0.672 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(4)'
1000000 loops, best of 3: 0.744 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(8)'
1000000 loops, best of 3: 0.762 usec per loop

$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et()'
1000000 loops, best of 3: 0.658 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(4)'
1000000 loops, best of 3: 0.73 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(8)'
1000000 loops, best of 3: 0.769 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(tabsize=4)'
1000000 loops, best of 3: 1.84 usec per loop
$ ./python -m timeit -s 'et = "a\tb\tc\td\te".expandtabs' 'et(tabsize=8)'
1000000 loops, best of 3: 1.89 usec per loop

If "tabsize" is not used the performances seem the same, if it's used it's 2-3 times slower.  I don't think expandtabs is used in performance-critical paths, but if it is the patch shouldn't affect it as long as people don't add "tabsize" to the call.

FTR the reason to add this is consistency (Python functions allow you to pass positional args as keywords too) and readability (s.expandtabs(3) might be read as "expand at most 3 tabs" or something else).
History
Date User Action Args
2013-04-28 07:40:28ezio.melottisetrecipients: + ezio.melotti, mark.dickinson, eric.araujo, serhiy.storchaka
2013-04-28 07:40:28ezio.melottisetmessageid: <1367134828.71.0.874509548552.issue17806@psf.upfronthosting.co.za>
2013-04-28 07:40:28ezio.melottilinkissue17806 messages
2013-04-28 07:40:28ezio.melotticreate