diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 82c19929..08027bd2 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -626,6 +626,7 @@ class FunctionExecution(Executed): return LazyDict(self.base.names_dict, self._copy_list) """ + @memoize_default(default=NO_DEFAULT) def _get_params(self): """ diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index 70ae81f2..44b7659f 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -1,19 +1,14 @@ """ -If you know what an abstract syntax tree (ast) is, you'll see that this module -is pretty much that. The classes represent syntax elements: ``Import``, -``Function``. +If you know what an abstract syntax tree (AST) is, you'll see that this module +is pretty much that. The classes represent syntax elements like functions and +imports. -A very central class is ``Scope``. It is not used directly by the parser, but -inherited. It's used by ``Function``, ``Class``, ``Flow``, etc. A ``Scope`` may -have ``subscopes``, ``imports`` and ``statements``. The entire parser is based -on scopes, because they also stand for indentation. +This is the "business logic" part of the parser. There's a lot of logic here +that makes it easier for Jedi (and other libraries to deal with a Python syntax +tree. -One special thing: - -``Array`` values are statements. But if you think about it, this makes sense. -``[1, 2+33]`` for example would be an Array with two ``Statement`` inside. This -is the easiest way to write a parser. The same behaviour applies to ``Param``, -which is being used in a function definition. +By using `get_code` on a module, you can get back the 1-to-1 representation of +the input given to the parser. This is important if you are using refactoring. The easiest way to play with this module is to use :class:`parsing.Parser`. :attr:`parsing.Parser.module` holds an instance of :class:`SubModule`: