The coding guide recommends that any **kwargs dictionary that is passed 
into a function should be copied so that the original is unaffected when 
items are popped off inside the function.  I noticed that this is not 
done by pylab functions generated by boilerplate.py, and in fact I don't 
think it is necessary:

In [9]:def test2(**kw):
    ...:    first = kw.pop('a')
    ...:    print first
    ...:    print kw
    ...:
    ...:

In [10]:test2(**kw)
c
{'b': 'd'}

In [11]:kw
Out[11]:{'a': 'c', 'b': 'd'}

Popping the 'a' entry inside the function did not affect the dictionary 
that was passed in; it evidently gets copied automatically.

Am I missing something?  Or should I go ahead and strip out the extra 
copies and modify the corresponding advice in CODING_GUIDE?

Eric

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to