'The type of the definition.
Here is an example of the value of this attribute.  Let\'s consider
the following source.  As what is in ``variable`` is unambiguous
to Jedi, :meth:`jedi.Script.goto_definitions` should return a list of
definition for ``sys``, ``f``, ``C`` and ``x``.
>>> from jedi import Script
>>> source = \'\'\'
... import keyword
... class C:
...     pass
... class D:
...     pass
... x = D()
... def f():
...     pass
... for variable in [keyword, f, C, x]:
...     variable\'\'\'
>>> script = Script(source)
>>> defs = script.goto_definitions()
Before showing what is in ``defs``, let\'s sort it by :attr:`line`
so that it is easy to relate the result to the source code.
>>> defs = sorted(defs, key=lambda d: d.line)
>>> defs                           # doctest: +NORMALIZE_WHITESPACE
[<Definition module keyword>, <Definition class C>,
<Definition instance D>, <Definition def f>]
Finally, here is what you can get from :attr:`type`:
>>> defs[0].type
\'module\'
>>> defs[1].type
\'class\'
>>> defs[2].type
\'instance\'
>>> defs[3].type
\'function\''

@property
def type(self):

    tree_name = self._name.tree_name
    resolve = False
    if (tree_name is not None):
        definition = tree_name.get_definition()
        if ((definition.type == 'import_from') and (tree_name in definition.get_defined_names())):
            resolve = True
    if (isinstance(self._name, imports.SubModuleName) or resolve):
        for context in self._name.infer():
            return context.api_type
    return self._name.api_type
