Pythonification of the asterisk-based collection packing/unpacking syntax

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Dec 25 11:15:25 EST 2011


On Sun, 25 Dec 2011 06:55:28 -0800, Eelco wrote:

> Anyway,  braces are used at
> least an order of magnitude more than collection packing/ unpacking in
> typical code.

That's a wild and unjustified claim. Here's a quick and dirty test, using 
the standard library as an example of typical idiomatic code:

[steve at orac ~]$ cd /usr/lib/python2.6
[steve at orac python2.6]$ grep "[*]args" *.py | wc -l
270
[steve at orac python2.6]$ grep "{" *.py | wc -l
550

Doesn't look like a factor of 10 difference to me.


And from one of my projects:

[steve at orac src]$ grep "[*]args" *.py | wc -l
267
[steve at orac src]$ grep "{" *.py | wc -l
8



-- 
Steven



More information about the Python-list mailing list