How do you use **name** with a function that I'd like to pass a keyword argument through?

For example, I have the following function:

```
def func(keyword1='A'):
     print keyword1

```

I can do this:

```
func.__name__
>> 'func'

```

But, I'd like to do this:

```
func(keyword1='B').__name__
>>> 'func'

```

The reason I'd like to do this is because I have another method that takes in this function as an argument and it needs to pull the name of the function and run that function with different keywords. 

So, what I'm really trying to do is get this function to work:

```
def Function_Name_And_Result(x):
    print x.__name__ + x()

Function_Name_And_Result(func(keyword1='B'))
>> funcB

```
['https://Stackoverflow.com/questions/23010340', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2850808/']
Python's functions are objects too, so you can pass them along just like any other object. What you're doing (which can't obviously work) is passing the result of calling the function. What you want is to pass the function and the function's argument:

```
def print_function_name_and_result(func, *args, **kw):
    print "%s : %s" % (func.__name__, func(*args, **kw))

print_function_name_and_result(func, keyword1='B')
>> func : B

```
If you have a method that takes a function, **then pass in the function**, not the return value.

You are instead calling the function. The `.__name__` attribute lookup is applied to the return value of that call. If you are passing the *return value* of a function call to your method, you are **not** passing the function object itself.

If you need to pass in a function that needs to be called with certain arguments *by the method*, you can pass in those extra arguments instead, and have the method use those arguments for you:

```
def Function_Name_And_Result(x, *args, **kw):
    print x.__name__, x(*args, **kw)

```

Now you can still pass in your function object *itself*:

```
Function_Name_And_Result(func, keyword1='B')

```

Demo:

```
>>> def Function_Name_And_Result(x, *args, **kw):
...     print x.__name__, x(*args, **kw)
... 
>>> def func(keyword1='A'):
...      print keyword1
... 
>>> Function_Name_And_Result(func, keyword1='B')
func B
None

```