[Python-3000] Using a list for *args (was: Type annotations:annotating generators)

Michael Chermside mcherm at mcherm.com
Thu Jun 1 22:19:36 CEST 2006

Collin Winter writes:
> I've attached the benchmarks as a comment on the patch, but I'll
> repeat them here. All times are usecs per loop.
      [statistics showing list is about 15% slower]

My memory is fuzzy here. Can someone repeat for me the reasons
why we wanted to use list? Were we just trying it out to see how
it worked, or was there a desire to change? Was the desire to
change because it improved some uses of the C api, or was it
just for "purity" in use of tuples vs lists?

I'm not a "need for speed" kind of guy, but I can't remember what
the advantages of the list approach were supposed to be.


By the way I'm curious about the following also:

# interpolating a list (I presume there's no advantage, but just checking)
./python -mtimeit 'def foo(*args): pass' 'foo(*range(10))'

# calling a function that doesn't use *args
./python -mtimeit 'def foo(): pass' 'foo()'
./python -mtimeit 'def foo(x): pass' 'foo(1)'
./python -mtimeit 'def foo(x,y): pass' 'foo(1,2)'
./python -mtimeit 'def foo(x,y,z): pass' 'foo(1,2,3)'

-- Michael Chermside

PS: Thanks, Collin, for trying this. I have to admit, I'm surprised
at how well-contained the changes turned out to be.

More information about the Python-3000 mailing list