[Python-3000] Using a list for *args (was: Type annotations: annotating generators)
Collin Winter
collinw at gmail.com
Wed May 31 21:33:13 CEST 2006
On 5/30/06, Guido van Rossum <guido at python.org> wrote:
> Please be specific. Which places are affected? This shouldn't be
> answered generically but on a case-by-case basis.
My final report:
All in all, the tuple->list change was minimally invasive. The two
most prevalent issues were
1) converting *args to a tuple for hashing purposes,
2) appending/prepending items to *args, then trying to
hash/do-something-else with it.
In both cases, the code changes were minor.
The most striking cases were logging.LogRecord.__init__() and
cgi.dolog() (broadly, "msg % args"), both of which are fed by numerous
other functions like
def warning(self, msg, *args):
self._log(msg, args, ....)
There are also other places that feed the logging.* and cgi.*
functions with dicts, meaning that a simple call to tuple() breaks
things sometimes. This means that extra logic has to be added to check
for the presence of a dict, slightly complicating this uncommon
usecase.
Overall, I've chosen to keep the external interfaces of the changed
modules/packages the same; if there's a desire to change them later,
this SVN commit can be used to figure out where adjustments should be
made. Most of the changes involve the test suite, primarily where
higher-order functions are concerned.
I've submitted a patch to implement this change as SF #1498441
(http://python.orf/sf/1498441); it's assigned to Guido.
Collin Winter
More information about the Python-3000
mailing list