diff options
author | jiansong <jian.song@easystack.cn> | 2016-10-07 19:23:48 -0700 |
---|---|---|
committer | jian.song <jian.song@easystack.cn> | 2016-10-19 02:08:46 +0000 |
commit | 91e098e0ea46a7674f9d0fb6e4734675c658f444 (patch) | |
tree | 6108cb39c0c035e3c1ae6ad875a6ae598a096e90 /troveclient/v1 | |
parent | a06ad17715d06ad95d52430e489929d9d956adc6 (diff) | |
download | python-troveclient-91e098e0ea46a7674f9d0fb6e4734675c658f444.tar.gz |
Avoid use xx=[] for parameter in function
Use xx = [] for the parameter for function, this parameter will
only be initialized at the first call, this is should be avoided.
Better choice is to set the initial value to None, then the initialization
time use xx= xx or []
more information:http://effbot.org/zone/default-values.htm
Change-Id: Icbade7dd4c7d231ae65fd4f8de673b484bab721c
Diffstat (limited to 'troveclient/v1')
-rw-r--r-- | troveclient/v1/management.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/troveclient/v1/management.py b/troveclient/v1/management.py index 4b57205..01ebf0a 100644 --- a/troveclient/v1/management.py +++ b/troveclient/v1/management.py @@ -272,7 +272,8 @@ class MgmtDatastoreVersions(base.ManagerWithFind): "version") def create(self, name, datastore_name, datastore_manager, image, - packages=[], active='true', default='false'): + packages=None, active='true', default='false'): + packages = packages or [] """Create a new datastore version.""" body = {"version": { "name": name, @@ -287,7 +288,8 @@ class MgmtDatastoreVersions(base.ManagerWithFind): return self._create("/mgmt/datastore-versions", body, None, True) def edit(self, datastore_version_id, datastore_manager=None, image=None, - packages=[], active=None, default=None): + packages=None, active=None, default=None): + packages = packages or [] """Update a datastore-version.""" body = {} if datastore_manager is not None: |