Question: I am using Perforce 2015 client (P4V) on Windows 7.

I changed some files in my IDE. Then I use "Folder Diff" in Perforce to locate them. I was expecting to find "checkout" right click menu on the "Folder Diff" Perforce window in order to move my changes to a changeset but I don't see any "checkout" around.

How can I checkout directly from Diff view?

Answer: 
If you know the function name, you can run exec on the string. Eval will not work as it only targets expressions. See [\r\n vs \n in python eval function](https://stackoverflow.com/questions/1204376/r-n-vs-n-in-python-eval-function). If you don't know the function name, but all your function have the same format you can try something like this:

```
def extract_function_from_string(content):
    exec(content)
    start = 4
    end = content.find("(")
    function_name = content[start:end]
    return eval(function_name)
my_function = extract_function_from_string("def my_function(x):\n    return x**2")
print my_function(5)

```

The train has left the safe and sound python station a long time ago, but I guess this is just a curiosity.
Try the [`exec`](https://docs.python.org/2/reference/simple_stmts.html#exec) statement:

```
>>> content = "def my_function(x):\n    return x**2"
>>> exec content
>>> my_function(5)
25

```