mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-23 13:51:27 +08:00
add recipes also to features & caveats
This commit is contained in:
@@ -98,6 +98,49 @@ might be dangerous. But if it does you're screwed anyways, because eventualy
|
|||||||
you're going to execute your code, which executes the import.
|
you're going to execute your code, which executes the import.
|
||||||
|
|
||||||
|
|
||||||
|
Recipes
|
||||||
|
-------
|
||||||
|
|
||||||
|
Here are some tips on how to use |jedi| efficiently.
|
||||||
|
|
||||||
|
|
||||||
|
.. _type-hinting:
|
||||||
|
|
||||||
|
Type Hinting
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
If |jedi| cannot detect the type of a function argument correctly (due to the
|
||||||
|
dynamic nature of Python), you can help it by hinting the type using
|
||||||
|
Sphinx-style info field lists or Epydoc docstrings.
|
||||||
|
|
||||||
|
**Sphinx style**
|
||||||
|
|
||||||
|
http://sphinx-doc.org/domains.html#info-field-lists
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
def myfunction(node):
|
||||||
|
"""Do something with a ``node``.
|
||||||
|
|
||||||
|
:type node: ProgramNode
|
||||||
|
|
||||||
|
"""
|
||||||
|
node.| # complete here
|
||||||
|
|
||||||
|
**Epydoc**
|
||||||
|
|
||||||
|
http://epydoc.sourceforge.net/manual-fields.html
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
def myfunction(node):
|
||||||
|
"""Do something with a ``node``.
|
||||||
|
|
||||||
|
@param node: ProgramNode
|
||||||
|
|
||||||
|
"""
|
||||||
|
node.| # complete here
|
||||||
|
|
||||||
A little history
|
A little history
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
.. include:: ../global.rst
|
|
||||||
|
|
||||||
Recipes
|
|
||||||
=======
|
|
||||||
|
|
||||||
Here are some tips on how to use |jedi| efficiently.
|
|
||||||
|
|
||||||
|
|
||||||
.. _type-hinting:
|
|
||||||
|
|
||||||
Type Hinting
|
|
||||||
------------
|
|
||||||
|
|
||||||
If |jedi| cannot detect the type of a function argument correctly (due to the
|
|
||||||
dynamic nature of Python), you can help it by hinting the type using
|
|
||||||
Sphinx-style info field lists or Epydoc docstrings.
|
|
||||||
|
|
||||||
**Sphinx style**
|
|
||||||
|
|
||||||
http://sphinx-doc.org/domains.html#info-field-lists
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
def myfunction(node):
|
|
||||||
"""Do something with a ``node``.
|
|
||||||
|
|
||||||
:type node: ProgramNode
|
|
||||||
|
|
||||||
"""
|
|
||||||
node.| # complete here
|
|
||||||
|
|
||||||
**Epydoc**
|
|
||||||
|
|
||||||
http://epydoc.sourceforge.net/manual-fields.html
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
def myfunction(node):
|
|
||||||
"""Do something with a ``node``.
|
|
||||||
|
|
||||||
@param node: ProgramNode
|
|
||||||
|
|
||||||
"""
|
|
||||||
node.| # complete here
|
|
||||||
Reference in New Issue
Block a user