On 02/04/16 10:59, Albert-Jan Roskam wrote: >>> however now pylint is returning: >>> task_07.py:36: [W0102(dangerous-default-value), iter_dict_funky_sum] >>> Dangerous default value DATA (__builtin__.dict) as argument
>> I would drop the default value for the parameter. >> ( I suspect that Python doesn't like DATA as a default value >> because it means you cant use the function anywhere DATA is >> not defined. But I'm not sure about that) > > I thought this warning was about the use of mutable default arguments Possibly so, I don't really know why the warning is there. The "fix" is the same, remove the default value it's not really helping here. (if you really wanted it you could use None: def foo(data = None): if not data: data = DATA # use global ... ) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor