Re: Python **kwargs ?




johnny wrote:
What is **kwargs mean in python? When you put double **, does it mean
passing by reference?

here's a little example:

def f(a, *args, **kw):
.... print 'a:',a
.... print 'args:',args
.... print 'kw:',kw
....
f(1,2,3,x=4)
a: 1
args: (2, 3)
kw: {'x': 4}
f(a=1,b=2,c=3)
a: 1
args: ()
kw: {'c': 3, 'b': 2}

.



Relevant Pages

  • RE: Observation on object references
    ... Wouldn't it be nice if we could declare a reference type in C# that would ... You then call processs and pass in the args variable, ... public class Handler2: HandlerBase ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Observation on object references
    ... What you want to do it pass a reference value to a function and if the ... You then call processs and pass in the args variable, ... public class Handler2: HandlerBase ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Observation on object references
    ... Assigning a new instance to a "ref" argument doesn't change the old reference ... public void SetAndReassignField ... You then call processs and pass in the args variable, ... public class Handler2: HandlerBase ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Basic question on local variable
    ... Sure reference is one way that a Fortran implementation might ... Intentargs by value. ... The point is that the standard describes what the behaviour is, ...
    (comp.lang.fortran)
  • Re: Excel automation
    ... would passing these objects as args to other subs/functions create another reference to them? ...
    (microsoft.public.excel.programming)