En Tue, 24 Apr 2007 22:31:59 -0300, Calvin Spealman <[EMAIL PROTECTED]>  
escribió:

> In the internal API when a C function is called and passed a kwarg
> dictionary, is there any case where anything else has a reference to
> it? I checked with the following code and it looks like even if you
> explicitly pass a dictionary with **kwargs, it still copies the
> dictionary anyway.

See the Python Reference Manual, 5.3.4 Calls
http://docs.python.org/ref/calls.html

Unfortunately it does not explicitely *guarantee* it will be a new  
dictionary. At least the way I read the docs, on a function call like this:

def foo(**kwargs): pass
d = {'a':1, 'b':2)
foo(**d)

Python could bind the existing d object to the formal parameter kwargs and  
still comply with the documented behavior. Some of my own code would break  
if that happened... :(

-- 
Gabriel Genellina
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to