[Python-checkins] r66548 - sandbox/trunk/2to3/lib2to3/refactor.py
benjamin.peterson
python-checkins at python.org
Mon Sep 22 04:14:14 CEST 2008
Author: benjamin.peterson
Date: Mon Sep 22 04:14:14 2008
New Revision: 66548
Log:
avoid the perils of mutable default arguments
Modified:
sandbox/trunk/2to3/lib2to3/refactor.py
Modified: sandbox/trunk/2to3/lib2to3/refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/refactor.py (original)
+++ sandbox/trunk/2to3/lib2to3/refactor.py Mon Sep 22 04:14:14 2008
@@ -94,7 +94,7 @@
_default_options = {"print_function": False}
- def __init__(self, fixer_names, options=None, explicit=[]):
+ def __init__(self, fixer_names, options=None, explicit=None):
"""Initializer.
Args:
@@ -103,7 +103,7 @@
explicit: a list of fixers to run even if they are explicit.
"""
self.fixers = fixer_names
- self.explicit = explicit
+ self.explicit = explicit or []
self.options = self._default_options.copy()
if options is not None:
self.options.update(options)
More information about the Python-checkins
mailing list