histrio/py-couchdb

Dict as default parameters: problems!

dedalus2000 opened this issue · 1 comments

After a couple of ours of debugging I discovered a big problem: many functions use dicts (that is a mutable object) as default argument, like params={}, headers={}

In python this have a non-intuitive behaviour:
http://pythonconquerstheuniverse.wordpress.com/category/python-gotchas/

In my code I was calling a function with no params, but the function had it filled due to a previus call.

Please change all them in the pythonic way:
def func(arg=None):
if arg is None: arg = {}

Your are absolutelly right! I go to fix it.