Converting a memory address to a function object
Question: A light in Maya has an attribute `Use Color Temperature`, which is a checkbox,
when I toggle it, a function is called inside Maya to actually do the work
behind the scene. Unfortunately the function address `<function callback at
0x0000000051CD7DD8>` is printed out instead of it's name. I don't know which
function is executed when clicking the checkbox. Is there any way of
converting this address to python function object or can I print the actual
name of the function using this memory address?


Answer: This means a function named `callback` is called.

I'd look for `def callback(...):` in the corresponding code file and see what
it does.

To re-produce your output all that's needed is a function with the name
`callback`:

    
    
    >>> def callback():
    ...     print "My name is Reut Sharabani"
    ... 
    >>> cb = callback
    >>> cb
    <function callback at 0x7f182f3ca6e0>
    

If you want to programmatically get a function's name:

    
    
    >>> cb.__name__
    'callback'
    

If you want to know more about it you can even disassemble it using
[`dis`](https://docs.python.org/2/library/dis.html) and it's [code
object](https://docs.python.org/2/c-api/code.html):

    
    
    >>> import dis
    >>> dis.dis(cb.__code__)
      2           0 LOAD_CONST               1 ('My name is Reut Sharabani')
                  3 PRINT_ITEM          
                  4 PRINT_NEWLINE       
                  5 LOAD_CONST               0 (None)
                  8 RETURN_VALUE      
    

