Defining a function in python will make it callable. What it does upon completion will only be relevant when you actually call it (by using the ()-operator). With no definition of a return statement, the function will return None. As described here: Python -- return, return None, and no return at all.
When executing the supplied commands, it goes belly-up as soon as you try to call function func, as something is not defined. I fear that pycharm is doing some invalid highlighting. d and d2 are callable, however d3 is not. Since you call func when assigning d3, it errors here and d3 does not exist.
Python 2.7.12 (default, Oct 10 2016, 12:50:22)
[GCC 5.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/usr/lib/python2.7/lib-dynload/readline.dll", 2);
import readline # dynamically loaded from /usr/lib/python2.7/lib-dynload/readline.dll
>>>
>>> def func():
... something
...
>>> d = { 'func': func }
>>> d['func']()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in func
NameError: global name 'something' is not defined
>>>
>>> d2 = { 'type': { 'func': func } }
>>> d2['type']['func']()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in func
NameError: global name 'something' is not defined
>>>
>>> d3 = { 'type': { 'func': func() } }
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in func
NameError: global name 'something' is not defined
>>> d3['type']['func']()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'd3' is not defined